提交 8deb8296 编写于 作者: S Steven Luscher 提交者: Mislav Marohnić

Guard against `xhr.getAllResponseHeaders()` being `null`

From https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest#getAllResponseHeaders():

> Returns all the response headers, separated by CRLF, as a string, or null if no response has been received.

I discovered this on Android, once when `xhr.getAllResponseHeaders()` evaluated to `null`.
上级 3fc66edc
......@@ -267,7 +267,7 @@
function headers(xhr) {
var head = new Headers()
var pairs = xhr.getAllResponseHeaders().trim().split('\n')
var pairs = (xhr.getAllResponseHeaders() || '').trim().split('\n')
pairs.forEach(function(header) {
var split = header.trim().split(':')
var key = split.shift().trim()
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册