mirror of
https://github.com/socketio/socket.io.git
synced 2026-04-30 03:00:39 -04:00
fix: check the format of the event name (#125)
A packet like '2[{"toString":"foo"}]' was decoded as:
{
type: EVENT,
data: [ { "toString": "foo" } ]
}
Which would then throw an error when passed to the EventEmitter class:
> TypeError: Cannot convert object to primitive value
> at Socket.emit (node:events:507:25)
> at .../node_modules/socket.io/lib/socket.js:531:14
Backported from 3b78117bf6
This commit is contained in:
committed by
GitHub
parent
cd11e38e1a
commit
ee00660749
@@ -50,7 +50,7 @@ describe('parser', function() {
|
||||
it('cleans itself up on close', function() {
|
||||
var packet = {
|
||||
type: parser.BINARY_EVENT,
|
||||
data: [new ArrayBuffer(2), new ArrayBuffer(3)],
|
||||
data: ["foo", new ArrayBuffer(2), new ArrayBuffer(3)],
|
||||
id: 0,
|
||||
nsp: '/'
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user