From 226626921d3dcf468daa86c69afcf5a79cc69d73 Mon Sep 17 00:00:00 2001 From: Nubami SQReder Date: Fri, 13 Sep 2019 12:58:24 +0300 Subject: [PATCH] [feat] Support extra charset info in Content-Type header (#619) XHR Polling failed to make handshake with server that adds charset info into Content-Type header. Closes https://github.com/socketio/engine.io-client/issues/618 --- lib/transports/polling-xhr.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/transports/polling-xhr.js b/lib/transports/polling-xhr.js index 561fa95fa..ef08b7ed0 100755 --- a/lib/transports/polling-xhr.js +++ b/lib/transports/polling-xhr.js @@ -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) {} @@ -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;