From 3e03865d89e3abf0755e6d3b8305632a5319fdfe Mon Sep 17 00:00:00 2001 From: Leo Kettmeir Date: Sun, 21 May 2023 03:43:54 +0200 Subject: feat(unstable): add more options to Deno.createHttpClient (#17385) --- cli/tests/unit/fetch_test.ts | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) (limited to 'cli/tests/unit/fetch_test.ts') diff --git a/cli/tests/unit/fetch_test.ts b/cli/tests/unit/fetch_test.ts index 7de04013e..d86795578 100644 --- a/cli/tests/unit/fetch_test.ts +++ b/cli/tests/unit/fetch_test.ts @@ -1531,6 +1531,40 @@ Deno.test( }, ); +Deno.test( + { + permissions: { net: true, read: true }, + // Doesn't pass on linux CI for unknown reasons (works fine locally on linux) + ignore: Deno.build.os !== "darwin", + }, + async function fetchForceHttp1OnHttp2Server() { + const client = Deno.createHttpClient({ http2: false, http1: true }); + await assertRejects( + () => fetch("http://localhost:5549/http_version", { client }), + TypeError, + "invalid HTTP version parsed", + ); + client.close(); + }, +); + +Deno.test( + { + permissions: { net: true, read: true }, + // Doesn't pass on linux CI for unknown reasons (works fine locally on linux) + ignore: Deno.build.os !== "darwin", + }, + async function fetchForceHttp2OnHttp1Server() { + const client = Deno.createHttpClient({ http2: true, http1: false }); + await assertRejects( + () => fetch("http://localhost:5548/http_version", { client }), + TypeError, + "stream closed because of a broken pipe", + ); + client.close(); + }, +); + Deno.test( { permissions: { net: true, read: true } }, async function fetchPrefersHttp2() { -- cgit v1.2.3