From 142bce1fb002f8240c4076e0a1b18b0c86489d65 Mon Sep 17 00:00:00 2001 From: Itaru Kitagawa Date: Mon, 16 Jan 2017 14:28:38 +0900 Subject: [PATCH 1/2] See config.responseType instead of request.responseType when suprressing DOMException --- lib/adapters/xhr.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/adapters/xhr.js b/lib/adapters/xhr.js index f5c397c..2ae64e5 100644 --- a/lib/adapters/xhr.js +++ b/lib/adapters/xhr.js @@ -137,7 +137,9 @@ module.exports = function xhrAdapter(config) { try { request.responseType = config.responseType; } catch (e) { - if (request.responseType !== 'json') { + // Expectes DOMException thrown by browsers not compatible XMLHttpRequest Level 2. + // But, this can be suppressed for 'json' type as it can be parsed by default 'transformResponse' function. + if (config.responseType !== 'json') { throw e; } } From b053f4b1b928ff2df9829d63cf7f00a1469613d9 Mon Sep 17 00:00:00 2001 From: Nick Uraltsev Date: Wed, 1 Mar 2017 22:54:44 -0800 Subject: [PATCH 2/2] Fixing typo --- lib/adapters/xhr.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/adapters/xhr.js b/lib/adapters/xhr.js index 2ae64e5..befd4fb 100644 --- a/lib/adapters/xhr.js +++ b/lib/adapters/xhr.js @@ -137,7 +137,7 @@ module.exports = function xhrAdapter(config) { try { request.responseType = config.responseType; } catch (e) { - // Expectes DOMException thrown by browsers not compatible XMLHttpRequest Level 2. + // Expected DOMException thrown by browsers not compatible XMLHttpRequest Level 2. // But, this can be suppressed for 'json' type as it can be parsed by default 'transformResponse' function. if (config.responseType !== 'json') { throw e;