summaryrefslogtreecommitdiff
path: root/js/fetch_test.ts
diff options
context:
space:
mode:
authorBartek IwaƄczuk <biwanczuk@gmail.com>2019-09-11 13:31:00 +0200
committerRyan Dahl <ry@tinyclouds.org>2019-09-11 07:31:00 -0400
commit85c51404aed21813df34c518a00c52a564d6fc69 (patch)
treea03c1aa4bc8a5a6fb17e222e1ea22ed2214c7792 /js/fetch_test.ts
parenta4e1d7d2e750831a1891b9267c8585a3e90083af (diff)
feat: Set user agent for http client (#2916)
Diffstat (limited to 'js/fetch_test.ts')
-rw-r--r--js/fetch_test.ts10
1 files changed, 10 insertions, 0 deletions
diff --git a/js/fetch_test.ts b/js/fetch_test.ts
index 083d5333c..77cc010a8 100644
--- a/js/fetch_test.ts
+++ b/js/fetch_test.ts
@@ -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:
//