summaryrefslogtreecommitdiff
path: root/cli/tests/unit_node/http_test.ts
diff options
context:
space:
mode:
authorLeo Kettmeir <crowlkats@toaxl.com>2023-05-23 03:03:10 +0200
committerGitHub <noreply@github.com>2023-05-23 03:03:10 +0200
commit58782589528dc442e2a1fdf6d98454cbf01ac2ad (patch)
tree69137cf6a5fe7daa3c2f7ab34060069edab7c35a /cli/tests/unit_node/http_test.ts
parent25232fa4e8ba2e9601699cff0cc9a6e6f03171ee (diff)
refactor: further work on node http client (#19211)
Diffstat (limited to 'cli/tests/unit_node/http_test.ts')
-rw-r--r--cli/tests/unit_node/http_test.ts28
1 files changed, 25 insertions, 3 deletions
diff --git a/cli/tests/unit_node/http_test.ts b/cli/tests/unit_node/http_test.ts
index e7d743dde..55160855e 100644
--- a/cli/tests/unit_node/http_test.ts
+++ b/cli/tests/unit_node/http_test.ts
@@ -470,13 +470,35 @@ Deno.test("[node/http] server unref", async () => {
res.statusCode = status;
res.end("");
});
-
- // This should let the program to exit without waiting for the
+
+ // This should let the program to exit without waiting for the
// server to close.
server.unref();
-
+
server.listen(async () => {
});
`);
assertEquals(statusCode, 0);
});
+
+Deno.test("[node/http] ClientRequest handle non-string headers", async () => {
+ // deno-lint-ignore no-explicit-any
+ let headers: any;
+ const def = deferred();
+ const req = http.request("http://localhost:4545/echo_server", {
+ method: "POST",
+ headers: { 1: 2 },
+ }, (resp) => {
+ headers = resp.headers;
+
+ resp.on("data", () => {});
+
+ resp.on("end", () => {
+ def.resolve();
+ });
+ });
+ req.once("error", (e) => def.reject(e));
+ req.end();
+ await def;
+ assertEquals(headers!["1"], "2");
+});