Skip to content

Commit bffb63e

Browse files
[revert] "[fix] Enable to utf8-decode string payloads (#88)" (#91)
This reverts commit 278a7e4.
1 parent 057f67f commit bffb63e

File tree

2 files changed

+2
-26
lines changed

2 files changed

+2
-26
lines changed

lib/browser.js

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ function map(ary, each, done) {
369369
* @api public
370370
*/
371371

372-
exports.decodePayload = function (data, binaryType, utf8decode, callback) {
372+
exports.decodePayload = function (data, binaryType, callback) {
373373
if (typeof data !== 'string') {
374374
return exports.decodePayloadAsBinary(data, binaryType, callback);
375375
}
@@ -379,24 +379,12 @@ exports.decodePayload = function (data, binaryType, utf8decode, callback) {
379379
binaryType = null;
380380
}
381381

382-
if (typeof utf8decode === 'function') {
383-
callback = utf8decode;
384-
utf8decode = null;
385-
}
386-
387382
var packet;
388383
if (data === '') {
389384
// parser error - ignoring payload
390385
return callback(err, 0, 1);
391386
}
392387

393-
if (utf8decode) {
394-
data = tryDecode(data);
395-
if (data === false) {
396-
return callback(err, 0, 1);
397-
}
398-
}
399-
400388
var length = '', n, msg;
401389

402390
for (var i = 0, l = data.length; i < l; i++) {

lib/index.js

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ function map(ary, each, done) {
265265
* @api public
266266
*/
267267

268-
exports.decodePayload = function (data, binaryType, utf8decode, callback) {
268+
exports.decodePayload = function (data, binaryType, callback) {
269269
if (typeof data !== 'string') {
270270
return exports.decodePayloadAsBinary(data, binaryType, callback);
271271
}
@@ -275,23 +275,11 @@ exports.decodePayload = function (data, binaryType, utf8decode, callback) {
275275
binaryType = null;
276276
}
277277

278-
if (typeof utf8decode === 'function') {
279-
callback = utf8decode;
280-
utf8decode = null;
281-
}
282-
283278
if (data === '') {
284279
// parser error - ignoring payload
285280
return callback(err, 0, 1);
286281
}
287282

288-
if (utf8decode) {
289-
data = tryDecode(data);
290-
if (data === false) {
291-
return callback(err, 0, 1);
292-
}
293-
}
294-
295283
var length = '', n, msg, packet;
296284

297285
for (var i = 0, l = data.length; i < l; i++) {

0 commit comments

Comments
 (0)