From 2ebce8eb7b22fec3ccd7bd45abf999883294acc7 Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Tue, 27 Oct 2020 13:49:36 +0100 Subject: [PATCH] set responseType after calling open --- src/platform/web/dom/request/xhr.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/platform/web/dom/request/xhr.js b/src/platform/web/dom/request/xhr.js index e397c336..ab5ac9f5 100644 --- a/src/platform/web/dom/request/xhr.js +++ b/src/platform/web/dom/request/xhr.js @@ -37,10 +37,11 @@ class RequestResult { function send(url, {method, headers, timeout, body, format}) { const xhr = new XMLHttpRequest(); + xhr.open(method, url); if (format === "buffer") { + // important to call this after calling open xhr.responseType = "arraybuffer"; } - xhr.open(method, url); if (headers) { for(const [name, value] of headers.entries()) { xhr.setRequestHeader(name, value);