diff options
Diffstat (limited to 'ext/node/polyfills/http.ts')
-rw-r--r-- | ext/node/polyfills/http.ts | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/ext/node/polyfills/http.ts b/ext/node/polyfills/http.ts index ab5e2b438..12d71277f 100644 --- a/ext/node/polyfills/http.ts +++ b/ext/node/polyfills/http.ts @@ -485,7 +485,7 @@ export class ServerResponse extends NodeWritable { return this.#headers.has(name); } - writeHead(status: number, headers: Record<string, string>) { + writeHead(status: number, headers: Record<string, string> = {}) { this.statusCode = status; for (const k in headers) { if (Object.hasOwn(headers, k)) { @@ -540,6 +540,11 @@ export class ServerResponse extends NodeWritable { // @ts-expect-error The signature for cb is stricter than the one implemented here return super.end(chunk, encoding, cb); } + + // Undocumented API used by `npm:compression`. + _implicitHeader() { + this.writeHead(this.statusCode); + } } // TODO(@AaronO): optimize |