Skip to content

Commit

Permalink
Fix issue #533
Browse files Browse the repository at this point in the history
  • Loading branch information
CrOrc committed Oct 23, 2017
1 parent 7a692dc commit 7f030fa
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions fetch.js
Expand Up @@ -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)
Expand Down

0 comments on commit 7f030fa

Please sign in to comment.