make sure cors errors on setting headers don't fail sending the request

This commit is contained in:
Bruno Windels 2020-11-16 15:10:25 +01:00
parent 83cbe78cd6
commit 6bd777e7be

View file

@ -45,7 +45,11 @@ function createXhr(url, {method, headers, timeout, format, uploadProgress}) {
}
if (headers) {
for(const [name, value] of headers.entries()) {
xhr.setRequestHeader(name, value);
try {
xhr.setRequestHeader(name, value);
} catch (err) {
console.info(`Could not set ${name} header: ${err.message}`);
}
}
}
if (timeout) {