summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cli/tests/unit_node/http_test.ts1
-rw-r--r--ext/node/polyfills/http.ts5
2 files changed, 6 insertions, 0 deletions
diff --git a/cli/tests/unit_node/http_test.ts b/cli/tests/unit_node/http_test.ts
index 825815ae6..ed52ccf13 100644
--- a/cli/tests/unit_node/http_test.ts
+++ b/cli/tests/unit_node/http_test.ts
@@ -355,6 +355,7 @@ Deno.test("[node/http] send request with non-chunked body", async () => {
assert(socket.readable);
socket.setKeepAlive();
socket.destroy();
+ socket.setTimeout(100);
});
req.write("hello ");
req.write("world");
diff --git a/ext/node/polyfills/http.ts b/ext/node/polyfills/http.ts
index ae670d5f0..78bd7cb07 100644
--- a/ext/node/polyfills/http.ts
+++ b/ext/node/polyfills/http.ts
@@ -8,6 +8,7 @@
const core = globalThis.__bootstrap.core;
import { TextEncoder } from "ext:deno_web/08_text_encoding.js";
import { type Deferred, deferred } from "ext:deno_node/_util/async.ts";
+import { setTimeout } from "ext:deno_web/02_timers.js";
import {
_normalizeArgs,
// createConnection,
@@ -289,6 +290,10 @@ class FakeSocket extends EventEmitter {
end() {}
destroy() {}
+
+ setTimeout(callback, timeout = 0, ...args) {
+ setTimeout(callback, timeout, args);
+ }
}
/** ClientRequest represents the http(s) request from the client */