diff options
author | 2023-07-11 21:30:24 +0900 | |
---|---|---|
committer | 2023-07-11 21:31:49 +0900 | |
commit | c4c5eb2d3257fdddf47b843cfb621098dca816ee (patch) | |
tree | 3ea70419eaef4351a1bab72112c03cd40fe7c013 | |
parent | e7afae305c40acda11c090803219755c2c44d052 (diff) | |
download | bun-c4c5eb2d3257fdddf47b843cfb621098dca816ee.tar.gz bun-c4c5eb2d3257fdddf47b843cfb621098dca816ee.tar.zst bun-c4c5eb2d3257fdddf47b843cfb621098dca816ee.zip |
use `Object.getPrototypeOf`
-rw-r--r-- | src/js/node/http.ts | 4 | ||||
-rw-r--r-- | src/js/out/modules/node/http.js | 5 |
2 files changed, 3 insertions, 6 deletions
diff --git a/src/js/node/http.ts b/src/js/node/http.ts index 3a283912e..563cb8c46 100644 --- a/src/js/node/http.ts +++ b/src/js/node/http.ts @@ -972,7 +972,6 @@ export class ServerResponse extends Writable { this.#firstWrite = undefined; this._writableState.decodeStrings = false; this.#deferred = undefined; - this.#originalWriteHead = this.writeHead; } req; @@ -990,7 +989,6 @@ 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 @@ -1062,7 +1060,7 @@ export class ServerResponse extends Writable { var data = this.#firstWrite || ""; this.#firstWrite = undefined; this.#finished = true; - if (this.writeHead !== this.#originalWriteHead) { + if (this.writeHead !== Object.getPrototypeOf(this).writeHead) { this._implicitHeader(); } this._reply( diff --git a/src/js/out/modules/node/http.js b/src/js/out/modules/node/http.js index 9cfaccd04..7a9b87604 100644 --- a/src/js/out/modules/node/http.js +++ b/src/js/out/modules/node/http.js @@ -630,7 +630,7 @@ class OutgoingMessage extends Writable { class ServerResponse extends Writable { constructor({ req, reply }) { super(); - this.req = req, this._reply = reply, this.sendDate = !0, this.statusCode = 200, this.headersSent = !1, this.statusMessage = void 0, this.#controller = void 0, this.#firstWrite = void 0, this._writableState.decodeStrings = !1, this.#deferred = void 0, this.#originalWriteHead = this.writeHead; + this.req = req, this._reply = reply, this.sendDate = !0, this.statusCode = 200, this.headersSent = !1, this.statusMessage = void 0, this.#controller = void 0, this.#firstWrite = void 0, this._writableState.decodeStrings = !1, this.#deferred = void 0; } req; _reply; @@ -647,7 +647,6 @@ class ServerResponse extends Writable { _removedContLen = !1; #deferred = void 0; #finished = !1; - #originalWriteHead; _implicitHeader() { this.writeHead(this.statusCode); } @@ -696,7 +695,7 @@ class ServerResponse extends Writable { _final(callback) { if (!this.headersSent) { var data = this.#firstWrite || ""; - if (this.#firstWrite = void 0, this.#finished = !0, this.writeHead !== this.#originalWriteHead) + if (this.#firstWrite = void 0, this.#finished = !0, this.writeHead !== Object.getPrototypeOf(this).writeHead) this._implicitHeader(); this._reply(new Response(data, { headers: this.#headers, |