summaryrefslogtreecommitdiff
path: root/cli/tests/unit_node
diff options
context:
space:
mode:
Diffstat (limited to 'cli/tests/unit_node')
-rw-r--r--cli/tests/unit_node/http_test.ts22
1 files changed, 22 insertions, 0 deletions
diff --git a/cli/tests/unit_node/http_test.ts b/cli/tests/unit_node/http_test.ts
index 5eb8c15bd..d1ed11632 100644
--- a/cli/tests/unit_node/http_test.ts
+++ b/cli/tests/unit_node/http_test.ts
@@ -2,6 +2,7 @@
import EventEmitter from "node:events";
import http, { type RequestOptions } from "node:http";
+import https from "node:https";
import {
assert,
assertEquals,
@@ -509,3 +510,24 @@ Deno.test("[node/http] ClientRequest handle non-string headers", async () => {
await def;
assertEquals(headers!["1"], "2");
});
+
+Deno.test("[node/http] ClientRequest uses HTTP/1.1", async () => {
+ let body = "";
+ const def = deferred();
+ const req = https.request("https://localhost:5545/http_version", {
+ method: "POST",
+ headers: { 1: 2 },
+ }, (resp) => {
+ resp.on("data", (chunk) => {
+ body += chunk;
+ });
+
+ resp.on("end", () => {
+ def.resolve();
+ });
+ });
+ req.once("error", (e) => def.reject(e));
+ req.end();
+ await def;
+ assertEquals(body, "HTTP/1.1");
+});