From 1c4a9665e2a2ff85ccb8060f168dafafa4d2194b Mon Sep 17 00:00:00 2001 From: Marcos Casagrande Date: Mon, 25 May 2020 15:26:36 +0200 Subject: fix: Allow ArrayBuffer as Fetch request body (#5831) --- cli/js/web/fetch.ts | 2 ++ 1 file changed, 2 insertions(+) (limited to 'cli/js') 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"; -- cgit v1.2.3