提交 c2556f3e 编写于 作者: M Mislav Marohnić

Only define `arrayBuffer()` if Blob is also supported

It turns out that Android 4.0 implements ArrayBuffer but no Blob.

This restores the behavior that v1.0 had, but which regressed in v1.1.0.
上级 1ddcadb2
...@@ -259,6 +259,14 @@ ...@@ -259,6 +259,14 @@
return Promise.resolve(new Blob([this._bodyText])) return Promise.resolve(new Blob([this._bodyText]))
} }
} }
this.arrayBuffer = function() {
if (this._bodyArrayBuffer) {
return consumed(this) || Promise.resolve(this._bodyArrayBuffer)
} else {
return this.blob().then(readBlobAsArrayBuffer)
}
}
} }
this.text = function() { this.text = function() {
...@@ -278,16 +286,6 @@ ...@@ -278,16 +286,6 @@
} }
} }
if (support.arrayBuffer) {
this.arrayBuffer = function() {
if (this._bodyArrayBuffer) {
return consumed(this) || Promise.resolve(this._bodyArrayBuffer)
} else {
return this.blob().then(readBlobAsArrayBuffer)
}
}
}
if (support.formData) { if (support.formData) {
this.formData = function() { this.formData = function() {
return this.text().then(decode) return this.text().then(decode)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册