From ec3f677e9240a8947b6a12e15e3fd77e9bbb51d5 Mon Sep 17 00:00:00 2001 From: Damien Arrachequesne Date: Sun, 8 Nov 2020 01:56:49 +0100 Subject: [PATCH] refactor: remove binary handling for the polling transport Since Engine.IO v4, the binary payloads are always encoded as base64 with the polling transport. See https://github.com/socketio/engine.io-protocol#difference-between-v3-and-v4 Possibly related: https://github.com/socketio/socket.io-client/issues/1391 --- lib/transports/polling-xhr.js | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) diff --git a/lib/transports/polling-xhr.js b/lib/transports/polling-xhr.js index c7b7d9b3b..9988b021a 100755 --- a/lib/transports/polling-xhr.js +++ b/lib/transports/polling-xhr.js @@ -308,24 +308,8 @@ class Request extends Emitter { * @api private */ onLoad() { - let data; - try { - let contentType; - try { - contentType = this.xhr.getResponseHeader("Content-Type"); - } catch (e) {} - if ( - contentType === "application/octet-stream" || - contentType === "application/octet-stream; charset=UTF-8" - ) { - data = this.xhr.response || this.xhr.responseText; - } else { - data = this.xhr.responseText; - } - } catch (e) { - this.onError(e); - } - if (null != data) { + const data = this.xhr.responseText; + if (data !== null) { this.onData(data); } }