feat(cli): custom http client for fetch (#6918)

This commit is contained in:
Luca Casonato 2020-08-05 20:44:03 +02:00 committed by GitHub
parent 91ed614aa8
commit ce7808baf0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 182 additions and 117 deletions

View file

@ -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();
},
);