From ce7808baf092e130ba1c5f073544072c5db958e7 Mon Sep 17 00:00:00 2001 From: Luca Casonato Date: Wed, 5 Aug 2020 20:44:03 +0200 Subject: feat(cli): custom http client for fetch (#6918) --- cli/tests/unit/fetch_test.ts | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'cli/tests') diff --git a/cli/tests/unit/fetch_test.ts b/cli/tests/unit/fetch_test.ts index 9562c48c7..012ce7b34 100644 --- a/cli/tests/unit/fetch_test.ts +++ b/cli/tests/unit/fetch_test.ts @@ -938,3 +938,21 @@ unitTest(function fetchResponseEmptyConstructor(): void { assertEquals(response.bodyUsed, false); assertEquals([...response.headers], []); }); + +unitTest( + { perms: { net: true, read: true } }, + async function fetchCustomHttpClientSuccess(): Promise< + void + > { + const client = Deno.createHttpClient( + { caFile: "./cli/tests/tls/RootCA.crt" }, + ); + const response = await fetch( + "https://localhost:5545/cli/tests/fixture.json", + { client }, + ); + const json = await response.json(); + assertEquals(json.name, "deno"); + client.close(); + }, +); -- cgit v1.2.3