diff options
Diffstat (limited to 'js/fetch_test.ts')
-rw-r--r-- | js/fetch_test.ts | 14 |
1 files changed, 14 insertions, 0 deletions
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<void> { 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 > { |