From 2a86edf0afd65af3020c8e6ad84e26d5a687e535 Mon Sep 17 00:00:00 2001 From: Marvin Hagemeister Date: Wed, 10 Jul 2024 10:05:41 +0200 Subject: 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. --- tests/unit_node/http_test.ts | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'tests/unit_node') 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( -- cgit v1.2.3