Skip to content

Commit

Permalink
Check support.blob as prerequisite for response.arrayBuffer()
Browse files Browse the repository at this point in the history
This is opposed to checking for native ArrayBuffer because the polyfill
will only define `arrayBuffer()` methods if Blob is available.
  • Loading branch information
mislav committed Jan 13, 2016
1 parent 4a5079d commit 5426561
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,7 @@ suite('Response', function() {
})
})

featureDependent(test, support.arrayBuffer, 'clone blob response', function() {
featureDependent(test, support.blob, 'clone blob response', function() {
return fetch('/binary').then(function(response) {
return Promise.all([response.clone().arrayBuffer(), response.arrayBuffer()]).then(function(bufs){
bufs.forEach(function(buf){
Expand Down Expand Up @@ -530,7 +530,7 @@ suite('Response', function() {

// https://fetch.spec.whatwg.org/#body-mixin
suite('Body mixin', function() {
featureDependent(suite, support.arrayBuffer, 'arrayBuffer', function() {
featureDependent(suite, support.blob, 'arrayBuffer', function() {
test('resolves arrayBuffer promise', function() {
return fetch('/hello').then(function(response) {
return response.arrayBuffer()
Expand Down Expand Up @@ -577,7 +577,6 @@ suite('Body mixin', function() {

test('rejects arrayBuffer promise after body is consumed', function() {
return fetch('/hello').then(function(response) {
assert(response.arrayBuffer, 'Body does not implement arrayBuffer')
assert.equal(response.bodyUsed, false)
response.blob()
assert.equal(response.bodyUsed, true)
Expand Down

0 comments on commit 5426561

Please sign in to comment.