aboutsummaryrefslogtreecommitdiff
path: root/src/js/node/http.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/js/node/http.ts')
-rw-r--r--src/js/node/http.ts7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/js/node/http.ts b/src/js/node/http.ts
index 253bcf4d8..3a283912e 100644
--- a/src/js/node/http.ts
+++ b/src/js/node/http.ts
@@ -972,6 +972,7 @@ export class ServerResponse extends Writable {
this.#firstWrite = undefined;
this._writableState.decodeStrings = false;
this.#deferred = undefined;
+ this.#originalWriteHead = this.writeHead;
}
req;
@@ -989,7 +990,7 @@ export class ServerResponse extends Writable {
_removedContLen = false;
#deferred: (() => void) | undefined = undefined;
#finished = false;
-
+ #originalWriteHead: (statusCode, statusMessage, headers) => ServerResponse;
// Express "compress" package uses this
_implicitHeader() {
// @ts-ignore
@@ -1061,7 +1062,9 @@ export class ServerResponse extends Writable {
var data = this.#firstWrite || "";
this.#firstWrite = undefined;
this.#finished = true;
- this._implicitHeader();
+ if (this.writeHead !== this.#originalWriteHead) {
+ this._implicitHeader();
+ }
this._reply(
new Response(data, {
headers: this.#headers,