diff --git a/lib/transports/polling.js b/lib/transports/polling.js index 5d15c0763..47bf36bb6 100644 --- a/lib/transports/polling.js +++ b/lib/transports/polling.js @@ -154,12 +154,12 @@ Polling.prototype.onDataRequest = function (req, res) { function onData (data) { var contentLength; - if (typeof data === 'string') { - chunks += data; - contentLength = Buffer.byteLength(chunks); - } else { + if (isBinary) { chunks = Buffer.concat([chunks, data]); contentLength = chunks.length; + } else { + chunks += data; + contentLength = Buffer.byteLength(chunks); } if (contentLength > self.maxHttpBufferSize) {