mirror of
https://github.com/vector-im/hydrogen-web.git
synced 2024-12-23 11:35:04 +01:00
make sure cors errors on setting headers don't fail sending the request
This commit is contained in:
parent
83cbe78cd6
commit
6bd777e7be
@ -45,7 +45,11 @@ function createXhr(url, {method, headers, timeout, format, uploadProgress}) {
|
|||||||
}
|
}
|
||||||
if (headers) {
|
if (headers) {
|
||||||
for(const [name, value] of headers.entries()) {
|
for(const [name, value] of headers.entries()) {
|
||||||
|
try {
|
||||||
xhr.setRequestHeader(name, value);
|
xhr.setRequestHeader(name, value);
|
||||||
|
} catch (err) {
|
||||||
|
console.info(`Could not set ${name} header: ${err.message}`);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (timeout) {
|
if (timeout) {
|
||||||
|
Loading…
Reference in New Issue
Block a user