未验证 提交 74e4fe8a 编写于 作者: J Jake Champion 提交者: GitHub

Merge pull request #575 from CrOrc/CrOrc-fix-resolve-IE-11

Co-authored-by: NJake Champion <me@jakechampion.name>
...@@ -471,19 +471,27 @@ export function fetch(input, init) { ...@@ -471,19 +471,27 @@ export function fetch(input, init) {
} }
options.url = 'responseURL' in xhr ? xhr.responseURL : options.headers.get('X-Request-URL') options.url = 'responseURL' in xhr ? xhr.responseURL : options.headers.get('X-Request-URL')
var body = 'response' in xhr ? xhr.response : xhr.responseText var body = 'response' in xhr ? xhr.response : xhr.responseText
setTimeout(function() {
resolve(new Response(body, options)) resolve(new Response(body, options))
}, 0)
} }
xhr.onerror = function() { xhr.onerror = function() {
setTimeout(function() {
reject(new TypeError('Network request failed')) reject(new TypeError('Network request failed'))
}, 0)
} }
xhr.ontimeout = function() { xhr.ontimeout = function() {
setTimeout(function() {
reject(new TypeError('Network request failed')) reject(new TypeError('Network request failed'))
}, 0)
} }
xhr.onabort = function() { xhr.onabort = function() {
setTimeout(function() {
reject(new DOMException('Aborted', 'AbortError')) reject(new DOMException('Aborted', 'AbortError'))
}, 0)
} }
function fixUrl(url) { function fixUrl(url) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册