summaryrefslogtreecommitdiff
path: root/cli/js/web/fetch.ts
diff options
context:
space:
mode:
authorMarcos Casagrande <marcoscvp90@gmail.com>2020-05-25 15:26:36 +0200
committerGitHub <noreply@github.com>2020-05-25 09:26:36 -0400
commit1c4a9665e2a2ff85ccb8060f168dafafa4d2194b (patch)
tree640e4d2d9e743b8dec8430f9ad9e4fd3751bf38e /cli/js/web/fetch.ts
parentc9f0e34e294241541ba59c3a7eb52f42df7ff993 (diff)
fix: Allow ArrayBuffer as Fetch request body (#5831)
Diffstat (limited to 'cli/js/web/fetch.ts')
-rw-r--r--cli/js/web/fetch.ts2
1 files changed, 2 insertions, 0 deletions
diff --git a/cli/js/web/fetch.ts b/cli/js/web/fetch.ts
index 3485a770a..9054465bf 100644
--- a/cli/js/web/fetch.ts
+++ b/cli/js/web/fetch.ts
@@ -505,6 +505,8 @@ export async function fetch(
contentType = "text/plain;charset=UTF-8";
} else if (isTypedArray(init.body)) {
body = init.body;
+ } else if (init.body instanceof ArrayBuffer) {
+ body = new Uint8Array(init.body);
} else if (init.body instanceof URLSearchParams) {
body = new TextEncoder().encode(init.body.toString());
contentType = "application/x-www-form-urlencoded;charset=UTF-8";