diff options
author | Bartek IwaĆczuk <biwanczuk@gmail.com> | 2023-05-29 23:05:45 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-29 23:05:45 +0200 |
commit | d90a75c0361e2d2bf45d6605cb0c7cb6d1a335a7 (patch) | |
tree | 107f9f3be7a17511b53b99a36084ab172c3a04b8 /cli/tests/unit_node/http_test.ts | |
parent | fc6ba92024d76d44349c36dcedd13994116db45b (diff) |
fix: use proper ALPN protocols if HTTP client is HTTP/1.1 only (#19303)
Closes https://github.com/denoland/deno/issues/16923
---------
Co-authored-by: crowlkats <crowlkats@toaxl.com>
Co-authored-by: Matt Mastracci <matthew@mastracci.com>
Diffstat (limited to 'cli/tests/unit_node/http_test.ts')
-rw-r--r-- | cli/tests/unit_node/http_test.ts | 22 |
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"); +}); |