From 7c7f1a9fe24856e3a155db1dc67d12d1586ffa37 Mon Sep 17 00:00:00 2001 From: Damien Arrachequesne Date: Wed, 12 Feb 2020 08:14:51 +0100 Subject: [PATCH] fix: properly assign options when creating the transport The query attribute was overwritten, due to the order of arguments in the assignment. The bug was introduced in the refactor (5f47a50). --- lib/socket.js | 8 ++++---- lib/transports/polling-xhr.js | 1 + 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/socket.js b/lib/socket.js index 246ade5cb..3322c361b 100644 --- a/lib/socket.js +++ b/lib/socket.js @@ -121,18 +121,18 @@ class Socket extends Emitter { if (this.id) query.sid = this.id; const opts = Object.assign( + {}, + this.opts.transportOptions[name], + this.opts, { query, socket: this, hostname: this.hostname, secure: this.secure, port: this.port - }, - this.opts.transportOptions[name], - this.opts + } ); - // console.log(opts); debug("options: %j", opts); return new transports[name](opts); diff --git a/lib/transports/polling-xhr.js b/lib/transports/polling-xhr.js index 91a1cfd59..93648a7f7 100755 --- a/lib/transports/polling-xhr.js +++ b/lib/transports/polling-xhr.js @@ -102,6 +102,7 @@ class XHR extends Polling { req.on("error", function(err) { self.onError("xhr poll error", err); }); + this.pollXhr = req; } }