Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
kt3k committed Sep 26, 2024
1 parent 9c1b39b commit bbd15fb
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
8 changes: 8 additions & 0 deletions ext/node/polyfills/http.ts
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,14 @@ class ClientRequest extends OutgoingMessage {
_writeHeader() {
const url = this._createUrlStrFromOptions();

const headers = [];
for (const key in this[kOutHeaders]) {
if (Object.hasOwn(this[kOutHeaders], key)) {
const entry = this[kOutHeaders][key];
this._processHeader(headers, entry[0], entry[1], false);
}
}

if (
this.method === "POST" || this.method === "PATCH" || this.method === "PUT"
) {
Expand Down
6 changes: 4 additions & 2 deletions tests/unit_node/http_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -524,7 +524,8 @@ Deno.test("[node/http] send request with chunked body", async () => {
};
const abortController = new AbortController();
const servePromise = Deno.serve({
hostname,
// TODO(kt3k): Enable this line for better compatibility with Node.js
// hostname,
port,
signal: abortController.signal,
onListen: undefined,
Expand Down Expand Up @@ -571,7 +572,8 @@ Deno.test("[node/http] send request with chunked body as default", async () => {
};
const abortController = new AbortController();
const servePromise = Deno.serve({
hostname,
// TODO(kt3k): Enable this line for better compatibility with Node.js
// hostname,
port,
signal: abortController.signal,
onListen: undefined,
Expand Down

0 comments on commit bbd15fb

Please sign in to comment.