summaryrefslogtreecommitdiff
path: root/cli
diff options
context:
space:
mode:
authorYoshiya Hinosawa <stibium121@gmail.com>2023-12-08 17:43:19 +0900
committerGitHub <noreply@github.com>2023-12-08 17:43:19 +0900
commit3a74fa60ca948b0bc1608ae0ad6e00236ccc846a (patch)
treea2a3036054bcfef88a5c61e0de7a3e6c7198387e /cli
parent2b3daa690dd8edd51b25ac2ea70ccb2928000fca (diff)
fix(ext/node): allow null value for req.setHeader (#21391)
Co-authored-by: Bartek IwaƄczuk <biwanczuk@gmail.com>
Diffstat (limited to 'cli')
-rw-r--r--cli/tests/unit_node/http_test.ts19
1 files changed, 19 insertions, 0 deletions
diff --git a/cli/tests/unit_node/http_test.ts b/cli/tests/unit_node/http_test.ts
index b2b8eda0f..ae708c343 100644
--- a/cli/tests/unit_node/http_test.ts
+++ b/cli/tests/unit_node/http_test.ts
@@ -835,3 +835,22 @@ Deno.test("[node/https] node:https exports globalAgent", async () => {
"node:https must export 'globalAgent' on module default export",
);
});
+
+Deno.test("[node/http] node:http request.setHeader(header, null) doesn't throw", () => {
+ {
+ const req = http.request("http://localhost:4545/");
+ req.on("error", () => {});
+ // @ts-expect-error - null is not a valid header value
+ req.setHeader("foo", null);
+ req.end();
+ req.destroy();
+ }
+ {
+ const req = https.request("https://localhost:4545/");
+ req.on("error", () => {});
+ // @ts-expect-error - null is not a valid header value
+ req.setHeader("foo", null);
+ req.end();
+ req.destroy();
+ }
+});