File tree Expand file tree Collapse file tree 2 files changed +10
-0
lines changed Expand file tree Collapse file tree 2 files changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -101,6 +101,9 @@ def decode(self, encoded_packet):
101101 else :
102102 self .namespace = ep [0 :sep ]
103103 ep = ep [sep + 1 :]
104+ q = self .namespace .find ('?' )
105+ if q != - 1 :
106+ self .namespace = self .namespace [0 :q ]
104107 if ep and ep [0 ].isdigit ():
105108 self .id = 0
106109 while ep [0 ].isdigit ():
Original file line number Diff line number Diff line change @@ -97,6 +97,13 @@ def test_decode_namespace(self):
9797 self .assertEqual (pkt .namespace , '/bar' )
9898 self .assertEqual (pkt .encode (), '2/bar,["foo"]' )
9999
100+ def test_decode_namespace_with_query_string (self ):
101+ # some Socket.IO clients mistakenly attach the query string to the
102+ # namespace
103+ pkt = packet .Packet (encoded_packet = '2/bar?a=b,["foo"]' )
104+ self .assertEqual (pkt .namespace , '/bar' )
105+ self .assertEqual (pkt .encode (), '2/bar,["foo"]' )
106+
100107 def test_encode_namespace_no_data (self ):
101108 pkt = packet .Packet (packet_type = packet .EVENT , namespace = '/bar' )
102109 self .assertEqual (pkt .encode (), '2/bar' )
You can’t perform that action at this time.
0 commit comments