summaryrefslogtreecommitdiff
path: root/js/fetch_test.ts
diff options
context:
space:
mode:
authorKurt Mackey <mrkurt@gmail.com>2019-05-01 22:56:42 -0500
committerRyan Dahl <ry@tinyclouds.org>2019-05-01 23:56:42 -0400
commitc05cbc8eac91a9e1ab9b87c688ac4392eff01445 (patch)
treecc6e1e2b789ba6626c33523fa488681c86c1a987 /js/fetch_test.ts
parent1dd30f658fc031dd1d3cdb5b4c435ff0e48740c9 (diff)
Add Request global constructor (#2253)
Diffstat (limited to 'js/fetch_test.ts')
-rw-r--r--js/fetch_test.ts14
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
> {