Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix #595 by delaying setting xhr.responseType=arraybuffer until xhr r…
…ecieved headers state
  • Loading branch information
devoidfury committed Mar 7, 2018
commit 2ff3a5431ae7b6dffa72bde26cd984707c48d635
7 changes: 2 additions & 5 deletions lib/transports/polling-xhr.js
Original file line number Diff line number Diff line change
Expand Up @@ -220,9 +220,6 @@ Request.prototype.create = function () {
xhr.setRequestHeader('Accept', '*/*');
} catch (e) {}

if (this.supportsBinary) {
xhr.responseType = 'arraybuffer';
}

// ie6 check
if ('withCredentials' in xhr) {
Expand All @@ -245,8 +242,8 @@ Request.prototype.create = function () {
if (xhr.readyState === 2) {
try {
var contentType = xhr.getResponseHeader('Content-Type');
if (contentType !== 'application/octet-stream') {
xhr.responseType = 'text';
if (self.supportsBinary && contentType === 'application/octet-stream') {
xhr.responseType = 'arraybuffer';
}
} catch (e) {}
}
Expand Down