MCPcopy Create free account
hub / github.com/CodeDredd/h3-compression / cloneResponse

Function cloneResponse

src/helper.ts:153–164  ·  view source on GitHub ↗
(response: Response, body: BodyInit, method: string)

Source from the content-addressed store, hash-verified

151}
152
153function cloneResponse(response: Response, body: BodyInit, method: string): Response {
154 const headers = new Headers(response.headers)
155 headers.set('Content-Encoding', method)
156 // The length changes after compression, let the runtime recompute it.
157 headers.delete('Content-Length')
158
159 return new Response(body, {
160 status: response.status,
161 statusText: response.statusText,
162 headers,
163 })
164}
165
166/**
167 * Compresses an h3 v2 response value with [Zlib]{@link https://nodejs.org/api/zlib.html}.

Callers 2

compressResponseFunction · 0.85
compressResponseStreamFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected