From 6b3e29ca08b4e993655a1868acd6871be2cf7a0c Mon Sep 17 00:00:00 2001 From: Damien Arrachequesne Date: Mon, 24 Apr 2017 13:36:42 +0200 Subject: [PATCH] [revert] "[fix] Enable to utf8-decode string payloads (#88)" This reverts commit 278a7e45e71d905204e8efb1df95202040ebec28. --- lib/browser.js | 14 +------------- lib/index.js | 14 +------------- 2 files changed, 2 insertions(+), 26 deletions(-) diff --git a/lib/browser.js b/lib/browser.js index 4f42832..5a5e506 100644 --- a/lib/browser.js +++ b/lib/browser.js @@ -369,7 +369,7 @@ function map(ary, each, done) { * @api public */ -exports.decodePayload = function (data, binaryType, utf8decode, callback) { +exports.decodePayload = function (data, binaryType, callback) { if (typeof data !== 'string') { return exports.decodePayloadAsBinary(data, binaryType, callback); } @@ -379,24 +379,12 @@ exports.decodePayload = function (data, binaryType, utf8decode, callback) { binaryType = null; } - if (typeof utf8decode === 'function') { - callback = utf8decode; - utf8decode = null; - } - var packet; if (data === '') { // parser error - ignoring payload return callback(err, 0, 1); } - if (utf8decode) { - data = tryDecode(data); - if (data === false) { - return callback(err, 0, 1); - } - } - var length = '', n, msg; for (var i = 0, l = data.length; i < l; i++) { diff --git a/lib/index.js b/lib/index.js index c58c7e9..c01b0a0 100644 --- a/lib/index.js +++ b/lib/index.js @@ -265,7 +265,7 @@ function map(ary, each, done) { * @api public */ -exports.decodePayload = function (data, binaryType, utf8decode, callback) { +exports.decodePayload = function (data, binaryType, callback) { if (typeof data !== 'string') { return exports.decodePayloadAsBinary(data, binaryType, callback); } @@ -275,23 +275,11 @@ exports.decodePayload = function (data, binaryType, utf8decode, callback) { binaryType = null; } - if (typeof utf8decode === 'function') { - callback = utf8decode; - utf8decode = null; - } - if (data === '') { // parser error - ignoring payload return callback(err, 0, 1); } - if (utf8decode) { - data = tryDecode(data); - if (data === false) { - return callback(err, 0, 1); - } - } - var length = '', n, msg, packet; for (var i = 0, l = data.length; i < l; i++) {