summaryrefslogtreecommitdiff
path: root/tests/unit_node/http_test.ts
diff options
context:
space:
mode:
authorMarvin Hagemeister <marvin@deno.com>2024-07-10 10:05:41 +0200
committerGitHub <noreply@github.com>2024-07-10 10:05:41 +0200
commit2a86edf0afd65af3020c8e6ad84e26d5a687e535 (patch)
treeed10043cbbd8d1e5f6ff147975a787f09f35b952 /tests/unit_node/http_test.ts
parent92d567d3562600b2b06791353eeccf8f1d5c4f0f (diff)
fix(node/http): don't error if request destroyed before send (#24497)
A request can be destroyed before it was even made in the Node http API. We errored on that. This issue was discovered in the JSDOM test suite.
Diffstat (limited to 'tests/unit_node/http_test.ts')
-rw-r--r--tests/unit_node/http_test.ts9
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/unit_node/http_test.ts b/tests/unit_node/http_test.ts
index a053f3a27..71043d985 100644
--- a/tests/unit_node/http_test.ts
+++ b/tests/unit_node/http_test.ts
@@ -994,6 +994,15 @@ Deno.test(
},
);
+Deno.test(
+ "[node/http] client destroy before sending request should not error",
+ () => {
+ const request = http.request("http://localhost:5929/");
+ // Calling this would throw
+ request.destroy();
+ },
+);
+
Deno.test("[node/http] node:http exports globalAgent", async () => {
const http = await import("node:http");
assert(