mirror of
https://github.com/vector-im/hydrogen-web.git
synced 2024-12-23 11:35:04 +01:00
set responseType after calling open
This commit is contained in:
parent
a61d7fc68a
commit
2ebce8eb7b
@ -37,10 +37,11 @@ class RequestResult {
|
|||||||
|
|
||||||
function send(url, {method, headers, timeout, body, format}) {
|
function send(url, {method, headers, timeout, body, format}) {
|
||||||
const xhr = new XMLHttpRequest();
|
const xhr = new XMLHttpRequest();
|
||||||
|
xhr.open(method, url);
|
||||||
if (format === "buffer") {
|
if (format === "buffer") {
|
||||||
|
// important to call this after calling open
|
||||||
xhr.responseType = "arraybuffer";
|
xhr.responseType = "arraybuffer";
|
||||||
}
|
}
|
||||||
xhr.open(method, url);
|
|
||||||
if (headers) {
|
if (headers) {
|
||||||
for(const [name, value] of headers.entries()) {
|
for(const [name, value] of headers.entries()) {
|
||||||
xhr.setRequestHeader(name, value);
|
xhr.setRequestHeader(name, value);
|
||||||
|
Loading…
Reference in New Issue
Block a user