@@ -320,6 +320,7 @@ describe('WebSocketServer', () => {
320
320
const wss = new WebSocket . Server ( { noServer : true , path : '/foo' } ) ;
321
321
322
322
assert . strictEqual ( wss . shouldHandle ( { url : '/foo' } ) , true ) ;
323
+ assert . strictEqual ( wss . shouldHandle ( { url : '/foo?bar=baz' } ) , true ) ;
323
324
} ) ;
324
325
325
326
it ( "returns false when the path doesn't match" , ( ) => {
@@ -546,6 +547,41 @@ describe('WebSocketServer', () => {
546
547
} ) ;
547
548
} ) ;
548
549
550
+ it ( 'handles unsupported extensions' , ( done ) => {
551
+ const wss = new WebSocket . Server (
552
+ {
553
+ perMessageDeflate : true ,
554
+ port : 0
555
+ } ,
556
+ ( ) => {
557
+ const req = http . get ( {
558
+ port : wss . address ( ) . port ,
559
+ headers : {
560
+ Connection : 'Upgrade' ,
561
+ Upgrade : 'websocket' ,
562
+ 'Sec-WebSocket-Key' : 'dGhlIHNhbXBsZSBub25jZQ==' ,
563
+ 'Sec-WebSocket-Version' : 13 ,
564
+ 'Sec-WebSocket-Extensions' : 'foo; bar'
565
+ }
566
+ } ) ;
567
+
568
+ req . on ( 'upgrade' , ( res , socket , head ) => {
569
+ if ( head . length ) socket . unshift ( head ) ;
570
+
571
+ socket . once ( 'data' , ( chunk ) => {
572
+ assert . strictEqual ( chunk [ 0 ] , 0x88 ) ;
573
+ wss . close ( done ) ;
574
+ } ) ;
575
+ } ) ;
576
+ }
577
+ ) ;
578
+
579
+ wss . on ( 'connection' , ( ws ) => {
580
+ assert . strictEqual ( ws . extensions , '' ) ;
581
+ ws . close ( ) ;
582
+ } ) ;
583
+ } ) ;
584
+
549
585
describe ( '`verifyClient`' , ( ) => {
550
586
it ( 'can reject client synchronously' , ( done ) => {
551
587
const wss = new WebSocket . Server (
0 commit comments