summaryrefslogtreecommitdiff
path: root/cli/tests
diff options
context:
space:
mode:
authorLuca Casonato <lucacasonato@yahoo.com>2020-08-05 20:44:03 +0200
committerGitHub <noreply@github.com>2020-08-05 20:44:03 +0200
commitce7808baf092e130ba1c5f073544072c5db958e7 (patch)
treecc8f9a167973aed549194c4ac5c8291a82c17cdf /cli/tests
parent91ed614aa80f5a08669be3fe5031a95e6e75f194 (diff)
feat(cli): custom http client for fetch (#6918)
Diffstat (limited to 'cli/tests')
-rw-r--r--cli/tests/unit/fetch_test.ts18
1 files changed, 18 insertions, 0 deletions
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();
+ },
+);