summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBartek IwaƄczuk <biwanczuk@gmail.com>2023-07-25 09:17:53 +0200
committerGitHub <noreply@github.com>2023-07-25 07:17:53 +0000
commitbd79baea5e6734ab70802cd2c2532a491a987ff7 (patch)
treee1b2ddd34097d62a93ab246a42353850245b9868
parent3d3590063954dd30c1ebea02aad136878eeee04e (diff)
fix(node): add writable and readable fields to FakeSocket (#19931)
Closes https://github.com/denoland/deno/issues/19927
-rw-r--r--cli/tests/unit_node/http_test.ts2
-rw-r--r--ext/node/polyfills/http.ts2
2 files changed, 4 insertions, 0 deletions
diff --git a/cli/tests/unit_node/http_test.ts b/cli/tests/unit_node/http_test.ts
index 62cfe59a8..a361ff257 100644
--- a/cli/tests/unit_node/http_test.ts
+++ b/cli/tests/unit_node/http_test.ts
@@ -352,6 +352,8 @@ Deno.test("[node/http] send request with non-chunked body", async () => {
assertEquals(requestBody, "hello world");
});
req.on("socket", (socket) => {
+ assert(socket.writable);
+ assert(socket.readable);
socket.setKeepAlive();
socket.destroy();
});
diff --git a/ext/node/polyfills/http.ts b/ext/node/polyfills/http.ts
index bba11cdc1..b34c45f9c 100644
--- a/ext/node/polyfills/http.ts
+++ b/ext/node/polyfills/http.ts
@@ -279,6 +279,8 @@ class FakeSocket extends EventEmitter {
this.remoteAddress = opts.hostname;
this.remotePort = opts.port;
this.encrypted = opts.encrypted;
+ this.writable = true;
+ this.readable = true;
}
setKeepAlive() {}