diff options
| author | Yoshiya Hinosawa <stibium121@gmail.com> | 2023-04-18 15:20:36 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-04-18 15:20:36 +0900 |
| commit | 6efaef606af890e05deab0a892b1214f7f8421a9 (patch) | |
| tree | 911cc74ea1b67a5b45711b6c0633850eac8e47e6 /ext/node | |
| parent | d2d62b6312f9c09f91e26acd0b4d88b3ddcf94cf (diff) | |
fix(ext/node): polyfill response._implicitHeader method (#18738)
Diffstat (limited to 'ext/node')
| -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 |
