mirror of
https://github.com/denoland/deno.git
synced 2025-07-24 13:44:08 +00:00
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>
This commit is contained in:
parent
fc6ba92024
commit
d90a75c036
6 changed files with 81 additions and 4 deletions
|
@ -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");
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue