Skip to content

Commit

Permalink
refactor: remove binary handling for the polling transport
Browse files Browse the repository at this point in the history
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: socketio/socket.io-client#1391
  • Loading branch information
darrachequesne committed Nov 8, 2020
1 parent 1764916 commit ec3f677
Showing 1 changed file with 2 additions and 18 deletions.
20 changes: 2 additions & 18 deletions lib/transports/polling-xhr.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Expand Down

0 comments on commit ec3f677

Please sign in to comment.