Skip to content

Commit

Permalink
Fail hard when getArrayBuffer returns a 200 without content
Browse files Browse the repository at this point in the history
  • Loading branch information
vicapow committed Oct 17, 2016
1 parent c7d1464 commit 43fbe47
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions js/util/ajax.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ exports.getArrayBuffer = function(url, callback) {
callback(e);
};
xhr.onload = function() {
if (xhr.response.byteLength === 0 && xhr.status === 200) {
return callback(new Error('http status 200 returned without content.'));
}
if (xhr.status >= 200 && xhr.status < 300 && xhr.response) {
callback(null, xhr.response);
} else {
Expand Down

0 comments on commit 43fbe47

Please sign in to comment.