mirror of
https://github.com/denoland/deno.git
synced 2025-08-03 18:38:33 +00:00
feat(cli): custom http client for fetch (#6918)
This commit is contained in:
parent
91ed614aa8
commit
ce7808baf0
6 changed files with 182 additions and 117 deletions
|
@ -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();
|
||||
},
|
||||
);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue