Skip to content

Commit

Permalink
[feat] Support extra charset info in Content-Type header (#619)
Browse files Browse the repository at this point in the history
XHR Polling failed to make handshake with server that adds charset info into Content-Type header.

Closes #618
  • Loading branch information
SQReder authored and darrachequesne committed Sep 13, 2019
1 parent 2847411 commit 2266269
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/transports/polling-xhr.js
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ Request.prototype.create = function () {
if (xhr.readyState === 2) {
try {
var contentType = xhr.getResponseHeader('Content-Type');
if (self.supportsBinary && contentType === 'application/octet-stream') {
if (self.supportsBinary && contentType === 'application/octet-stream' || contentType === 'application/octet-stream; charset=UTF-8') {
xhr.responseType = 'arraybuffer';
}
} catch (e) {}
Expand Down Expand Up @@ -357,7 +357,7 @@ Request.prototype.onLoad = function () {
try {
contentType = this.xhr.getResponseHeader('Content-Type');
} catch (e) {}
if (contentType === 'application/octet-stream') {
if (contentType === 'application/octet-stream' || contentType === 'application/octet-stream; charset=UTF-8') {
data = this.xhr.response || this.xhr.responseText;
} else {
data = this.xhr.responseText;
Expand Down

0 comments on commit 2266269

Please sign in to comment.