From 7f030fab4d79433204331cefe365f5fbbab9e992 Mon Sep 17 00:00:00 2001 From: Roman Yakubuk Date: Mon, 23 Oct 2017 16:47:30 +0300 Subject: [PATCH 1/3] Fix issue #533 --- fetch.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/fetch.js b/fetch.js index f2f466d7..23041fe3 100644 --- a/fetch.js +++ b/fetch.js @@ -432,15 +432,21 @@ } options.url = 'responseURL' in xhr ? xhr.responseURL : options.headers.get('X-Request-URL') var body = 'response' in xhr ? xhr.response : xhr.responseText - resolve(new Response(body, options)) + setTimeout(function() { + resolve(new Response(body, options)); + }, 0); } xhr.onerror = function() { - reject(new TypeError('Network request failed')) + setTimeout(function() { + reject(new TypeError('Network request failed')); + }, 0); } xhr.ontimeout = function() { - reject(new TypeError('Network request failed')) + setTimeout(function() { + reject(new TypeError('Network request failed')); + }, 0); } xhr.open(request.method, request.url, true) From a8b7060481afb9fbc437bbbdd7d4539e72695c47 Mon Sep 17 00:00:00 2001 From: Jake Champion Date: Mon, 1 Jun 2020 23:16:32 +0100 Subject: [PATCH 2/3] Update fetch.js --- fetch.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fetch.js b/fetch.js index b251ee39..20209e82 100644 --- a/fetch.js +++ b/fetch.js @@ -491,7 +491,7 @@ export function fetch(input, init) { xhr.onabort = function() { setTimeout(function() { reject(new DOMException('Aborted', 'AbortError')) - }, 0) + }) } function fixUrl(url) { From 86407492a1cad0beca3545a2803c51b929188b13 Mon Sep 17 00:00:00 2001 From: Jake Champion Date: Mon, 1 Jun 2020 23:21:34 +0100 Subject: [PATCH 3/3] Update fetch.js --- fetch.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fetch.js b/fetch.js index 20209e82..b251ee39 100644 --- a/fetch.js +++ b/fetch.js @@ -491,7 +491,7 @@ export function fetch(input, init) { xhr.onabort = function() { setTimeout(function() { reject(new DOMException('Aborted', 'AbortError')) - }) + }, 0) } function fixUrl(url) {