mirror of
https://github.com/denoland/deno.git
synced 2024-12-12 02:27:46 -05:00
fixes
This commit is contained in:
parent
9c1b39ba2d
commit
2f9cdaa67d
2 changed files with 16 additions and 7 deletions
|
@ -419,6 +419,14 @@ class ClientRequest extends OutgoingMessage {
|
||||||
_writeHeader() {
|
_writeHeader() {
|
||||||
const url = this._createUrlStrFromOptions();
|
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 (
|
if (
|
||||||
this.method === "POST" || this.method === "PATCH" || this.method === "PUT"
|
this.method === "POST" || this.method === "PATCH" || this.method === "PUT"
|
||||||
) {
|
) {
|
||||||
|
@ -447,6 +455,10 @@ class ClientRequest extends OutgoingMessage {
|
||||||
await op_node_http_wait_for_connection(connRid);
|
await op_node_http_wait_for_connection(connRid);
|
||||||
this.emit("requestReady");
|
this.emit("requestReady");
|
||||||
const res = await op_node_http_await_response(rid);
|
const res = await op_node_http_await_response(rid);
|
||||||
|
if (this._timeout) {
|
||||||
|
this._timeout.removeEventListener("abort", this._timeoutCb);
|
||||||
|
webClearTimeout(this._timeout[timerId]);
|
||||||
|
}
|
||||||
const incoming = new IncomingMessageForClient(this.socket);
|
const incoming = new IncomingMessageForClient(this.socket);
|
||||||
incoming.req = this;
|
incoming.req = this;
|
||||||
this.res = incoming;
|
this.res = incoming;
|
||||||
|
@ -659,11 +671,6 @@ class ClientRequest extends OutgoingMessage {
|
||||||
}
|
}
|
||||||
this.destroyed = true;
|
this.destroyed = true;
|
||||||
|
|
||||||
const rid = this._client?.[internalRidSymbol];
|
|
||||||
if (rid) {
|
|
||||||
core.tryClose(rid);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Request might be closed before we actually made it
|
// Request might be closed before we actually made it
|
||||||
if (this._req !== undefined && this._req.cancelHandleRid !== null) {
|
if (this._req !== undefined && this._req.cancelHandleRid !== null) {
|
||||||
core.tryClose(this._req.cancelHandleRid);
|
core.tryClose(this._req.cancelHandleRid);
|
||||||
|
|
|
@ -524,7 +524,8 @@ Deno.test("[node/http] send request with chunked body", async () => {
|
||||||
};
|
};
|
||||||
const abortController = new AbortController();
|
const abortController = new AbortController();
|
||||||
const servePromise = Deno.serve({
|
const servePromise = Deno.serve({
|
||||||
hostname,
|
// TODO(kt3k): Enable this line for better compatibility with Node.js
|
||||||
|
// hostname,
|
||||||
port,
|
port,
|
||||||
signal: abortController.signal,
|
signal: abortController.signal,
|
||||||
onListen: undefined,
|
onListen: undefined,
|
||||||
|
@ -571,7 +572,8 @@ Deno.test("[node/http] send request with chunked body as default", async () => {
|
||||||
};
|
};
|
||||||
const abortController = new AbortController();
|
const abortController = new AbortController();
|
||||||
const servePromise = Deno.serve({
|
const servePromise = Deno.serve({
|
||||||
hostname,
|
// TODO(kt3k): Enable this line for better compatibility with Node.js
|
||||||
|
// hostname,
|
||||||
port,
|
port,
|
||||||
signal: abortController.signal,
|
signal: abortController.signal,
|
||||||
onListen: undefined,
|
onListen: undefined,
|
||||||
|
|
Loading…
Reference in a new issue