From 6bd777e7be07a570164bd58d428e900e9cbfcc61 Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Mon, 16 Nov 2020 15:10:25 +0100 Subject: [PATCH] make sure cors errors on setting headers don't fail sending the request --- src/platform/web/dom/request/xhr.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/platform/web/dom/request/xhr.js b/src/platform/web/dom/request/xhr.js index e2b9c15b..98893387 100644 --- a/src/platform/web/dom/request/xhr.js +++ b/src/platform/web/dom/request/xhr.js @@ -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) {