diff options
author | Aaron O'Mullan <aaron.omullan@gmail.com> | 2021-03-18 23:54:26 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-18 23:54:26 +0100 |
commit | 7d12dd18992cc58ce9866c2e42d914c8c8cf6d7a (patch) | |
tree | d4cc0871a744b72b9a4f7b7c8e926741d9108a90 /cli/tests/unit/fetch_test.ts | |
parent | fb5a2786ec9854ceca840daeb9ae154dcf804d12 (diff) |
fix: fallback to default UA and CA data for Deno.createHttpClient() (#9830)
Diffstat (limited to 'cli/tests/unit/fetch_test.ts')
-rw-r--r-- | cli/tests/unit/fetch_test.ts | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/cli/tests/unit/fetch_test.ts b/cli/tests/unit/fetch_test.ts index 71307cd69..fa013f0c5 100644 --- a/cli/tests/unit/fetch_test.ts +++ b/cli/tests/unit/fetch_test.ts @@ -1064,6 +1064,27 @@ MNf4EgWfK+tZMnuqfpfO9740KzfcVoMNo4QJD4yn5YxroUOO/Azi ); unitTest( + { perms: { net: true } }, + async function fetchCustomClientUserAgent(): Promise< + void + > { + const data = "Hello World"; + const client = Deno.createHttpClient({}); + const response = await fetch("http://localhost:4545/echo_server", { + client, + method: "POST", + body: new TextEncoder().encode(data), + }); + assertEquals( + response.headers.get("user-agent"), + `Deno/${Deno.version.deno}`, + ); + await response.text(); + client.close(); + }, +); + +unitTest( { perms: { net: true }, }, |