1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-03 17:08:35 -05:00

enable another test case

This commit is contained in:
Yoshiya Hinosawa 2024-10-02 00:40:56 +09:00
parent 0467865e17
commit e60e727e5e
No known key found for this signature in database
GPG key ID: 9017DB4559488785
2 changed files with 8 additions and 9 deletions

View file

@ -15,7 +15,7 @@ import { TextEncoder } from "ext:deno_web/08_text_encoding.js";
import { setTimeout } from "ext:deno_web/02_timers.js"; import { setTimeout } from "ext:deno_web/02_timers.js";
import { import {
_normalizeArgs, _normalizeArgs,
createConnection as netCreateConnection, createConnection,
ListenOptions, ListenOptions,
Socket, Socket,
} from "node:net"; } from "node:net";
@ -414,7 +414,7 @@ class ClientRequest extends OutgoingMessage {
} }
} else { } else {
debug("CLIENT use net.createConnection", optsWithoutSignal); debug("CLIENT use net.createConnection", optsWithoutSignal);
this.onSocket(netCreateConnection(optsWithoutSignal)); this.onSocket(createConnection(optsWithoutSignal));
} }
} }
} }
@ -641,12 +641,13 @@ class ClientRequest extends OutgoingMessage {
if (chunk) { if (chunk) {
this.write_(chunk, encoding, null, true); this.write_(chunk, encoding, null, true);
} else if (!this._headerSent) { } else if (!this._headerSent) {
if (this.socket && !this.socket.connecting) { if (
(this.socket && !this.socket.connecting) || // socket is not connecting, or
(!this.socket && this.outputData.length === 0) // no data to send
) {
this._contentLength = 0; this._contentLength = 0;
this._implicitHeader(); this._implicitHeader();
this._send("", "latin1"); this._send("", "latin1");
} else {
//
} }
} }
if (this.socket && this._bodyWriter) { if (this.socket && this._bodyWriter) {
@ -696,6 +697,7 @@ class ClientRequest extends OutgoingMessage {
} }
this.aborted = true; this.aborted = true;
this.emit("abort"); this.emit("abort");
//process.nextTick(emitAbortNT, this);
this.destroy(); this.destroy();
} }

View file

@ -665,9 +665,7 @@ Deno.test("[node/http] server unref", async () => {
assertEquals(statusCode, 0); assertEquals(statusCode, 0);
}); });
Deno.test("[node/http] ClientRequest handle non-string headers", { Deno.test("[node/http] ClientRequest handle non-string headers", async () => {
ignore: true,
}, async () => {
// deno-lint-ignore no-explicit-any // deno-lint-ignore no-explicit-any
let headers: any; let headers: any;
const { promise, resolve, reject } = Promise.withResolvers<void>(); const { promise, resolve, reject } = Promise.withResolvers<void>();
@ -709,7 +707,6 @@ Deno.test("[node/http] ClientRequest uses HTTP/1.1", {
req.once("error", (e) => reject(e)); req.once("error", (e) => reject(e));
req.end(); req.end();
await promise; await promise;
console.log(body);
assertEquals(body, "HTTP/1.1"); assertEquals(body, "HTTP/1.1");
}); });