From 85c51404aed21813df34c518a00c52a564d6fc69 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20Iwa=C5=84czuk?= Date: Wed, 11 Sep 2019 13:31:00 +0200 Subject: feat: Set user agent for http client (#2916) --- js/fetch_test.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'js/fetch_test.ts') 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 { assert(response.headers.get("content-type").startsWith("text/javascript")); }); +testPerm({ net: true }, async function fetchUserAgent(): Promise { + 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: // -- cgit v1.2.3