mirror of
https://github.com/denoland/deno.git
synced 2025-09-27 04:39:10 +00:00
feat: Set user agent for http client (#2916)
This commit is contained in:
parent
a4e1d7d2e7
commit
85c51404ae
3 changed files with 22 additions and 0 deletions
|
@ -220,6 +220,16 @@ testPerm({ net: true }, async function fetchInitBlobBody(): Promise<void> {
|
|||
assert(response.headers.get("content-type").startsWith("text/javascript"));
|
||||
});
|
||||
|
||||
testPerm({ net: true }, async function fetchUserAgent(): Promise<void> {
|
||||
const data = "Hello World";
|
||||
const response = await fetch("http://localhost:4545/echo_server", {
|
||||
method: "POST",
|
||||
body: new TextEncoder().encode(data)
|
||||
});
|
||||
assertEquals(response.headers.get("user-agent"), `Deno/${Deno.version.deno}`);
|
||||
await response.text();
|
||||
});
|
||||
|
||||
// TODO(ry) The following tests work but are flaky. There's a race condition
|
||||
// somewhere. Here is what one of these flaky failures looks like:
|
||||
//
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue