aboutsummaryrefslogtreecommitdiff
path: root/src/js/out
diff options
context:
space:
mode:
authorGravatar Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> 2023-07-11 13:07:03 -0700
committerGravatar Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> 2023-07-11 13:07:03 -0700
commitbab58b754156cdd749faa6e5ee41bd4758346da6 (patch)
treea9e36ba811edb55ad4e75cec781a87aa1f5a48f0 /src/js/out
parentc4c5eb2d3257fdddf47b843cfb621098dca816ee (diff)
downloadbun-jarred/fix-http-compression.tar.gz
bun-jarred/fix-http-compression.tar.zst
bun-jarred/fix-http-compression.zip
Avoid Object.getPrototypeOfjarred/fix-http-compression
Diffstat (limited to 'src/js/out')
-rw-r--r--src/js/out/modules/node/http.js12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/js/out/modules/node/http.js b/src/js/out/modules/node/http.js
index 7a9b87604..d0937a945 100644
--- a/src/js/out/modules/node/http.js
+++ b/src/js/out/modules/node/http.js
@@ -626,6 +626,7 @@ class OutgoingMessage extends Writable {
return this;
}
}
+var OriginalWriteHeadFn, OriginalImplicitHeadFn;
class ServerResponse extends Writable {
constructor({ req, reply }) {
@@ -692,12 +693,15 @@ class ServerResponse extends Writable {
statusText: this.statusMessage ?? STATUS_CODES[this.statusCode]
}));
}
+ #drainHeadersIfObservable() {
+ if (this._implicitHeader === OriginalImplicitHeadFn && this.writeHead === OriginalWriteHeadFn)
+ return;
+ this._implicitHeader();
+ }
_final(callback) {
if (!this.headersSent) {
var data = this.#firstWrite || "";
- if (this.#firstWrite = void 0, this.#finished = !0, this.writeHead !== Object.getPrototypeOf(this).writeHead)
- this._implicitHeader();
- this._reply(new Response(data, {
+ this.#firstWrite = void 0, this.#finished = !0, this.#drainHeadersIfObservable(), this._reply(new Response(data, {
headers: this.#headers,
status: this.statusCode,
statusText: this.statusMessage ?? STATUS_CODES[this.statusCode]
@@ -783,6 +787,8 @@ class ServerResponse extends Writable {
return _writeHead(statusCode, statusMessage, headers, this), this;
}
}
+OriginalWriteHeadFn = ServerResponse.prototype.writeHead;
+OriginalImplicitHeadFn = ServerResponse.prototype._implicitHeader;
class ClientRequest extends OutgoingMessage {
#timeout;