From c05cbc8eac91a9e1ab9b87c688ac4392eff01445 Mon Sep 17 00:00:00 2001 From: Kurt Mackey Date: Wed, 1 May 2019 22:56:42 -0500 Subject: Add Request global constructor (#2253) --- js/fetch_test.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'js/fetch_test.ts') diff --git a/js/fetch_test.ts b/js/fetch_test.ts index cebef58e2..205f5fe3e 100644 --- a/js/fetch_test.ts +++ b/js/fetch_test.ts @@ -99,6 +99,20 @@ testPerm({ net: true }, async function fetchInitStringBody(): Promise { assert(response.headers.get("content-type").startsWith("text/plain")); }); +testPerm({ net: true }, async function fetchRequestInitStringBody(): Promise< + void +> { + const data = "Hello World"; + const req = new Request("http://localhost:4545/echo_server", { + method: "POST", + body: data + }); + const response = await fetch(req); + const text = await response.text(); + assertEquals(text, data); + assert(response.headers.get("content-type").startsWith("text/plain")); +}); + testPerm({ net: true }, async function fetchInitTypedArrayBody(): Promise< void > { -- cgit v1.2.3