diff options
Diffstat (limited to 'cli')
-rw-r--r-- | cli/tests/unit/fetch_test.ts | 19 | ||||
-rw-r--r-- | cli/tsc/dts/lib.deno.unstable.d.ts | 5 |
2 files changed, 24 insertions, 0 deletions
diff --git a/cli/tests/unit/fetch_test.ts b/cli/tests/unit/fetch_test.ts index e89abef30..35fe48dca 100644 --- a/cli/tests/unit/fetch_test.ts +++ b/cli/tests/unit/fetch_test.ts @@ -1569,6 +1569,25 @@ Deno.test( }, ); +Deno.test( + { permissions: { net: true, read: true } }, + async function createHttpClientAllowHost() { + const client = Deno.createHttpClient({ + allowHost: true, + }); + const res = await fetch("http://localhost:4545/echo_server", { + headers: { + "host": "example.com", + }, + client, + }); + assert(res.ok); + assertEquals(res.headers.get("host"), "example.com"); + await res.body?.cancel(); + client.close(); + }, +); + Deno.test({ permissions: { read: false } }, async function fetchFilePerm() { await assertRejects(async () => { await fetch(import.meta.resolve("../testdata/subdir/json_1.json")); diff --git a/cli/tsc/dts/lib.deno.unstable.d.ts b/cli/tsc/dts/lib.deno.unstable.d.ts index 1aa655646..eb612a655 100644 --- a/cli/tsc/dts/lib.deno.unstable.d.ts +++ b/cli/tsc/dts/lib.deno.unstable.d.ts @@ -837,6 +837,11 @@ declare namespace Deno { * @default {true} */ http2?: boolean; + /** Whether setting the host header is allowed or not. + * + * @default {false} + */ + allowHost?: boolean; } /** **UNSTABLE**: New API, yet to be vetted. |