@@ -146,13 +146,17 @@ nodeOnly(() => {
146146 it ( "forwards the incoming requests's headers" , async ( ) => {
147147 mockServer . forAnyWebSocket ( ) . thenPassThrough ( ) ;
148148
149- const ws = new WebSocket ( `ws://localhost:${ wsPort } ` , {
150- agent : new HttpProxyAgent ( `http://localhost:${ mockServer . port } ` ) ,
151- headers : {
152- 'echo-headers' : 'true' ,
153- 'Funky-HEADER-casing' : 'Header-Value'
149+ const ws = new WebSocket (
150+ `ws://localhost:${ wsPort } ` ,
151+ [ 'subprotocol-a' , 'subprotocol-b' ] ,
152+ {
153+ agent : new HttpProxyAgent ( `http://localhost:${ mockServer . port } ` ) ,
154+ headers : {
155+ 'echo-headers' : 'true' ,
156+ 'Funky-HEADER-casing' : 'Header-Value'
157+ }
154158 }
155- } ) ;
159+ ) ;
156160
157161 const response = await new Promise < Buffer > ( ( resolve , reject ) => {
158162 ws . on ( 'message' , resolve ) ;
@@ -172,7 +176,8 @@ nodeOnly(() => {
172176 [ 'Sec-WebSocket-Version' , '13' ] ,
173177 [ 'Connection' , 'Upgrade' ] ,
174178 [ 'Upgrade' , 'websocket' ] ,
175- [ 'Sec-WebSocket-Extensions' , 'permessage-deflate; client_max_window_bits' ]
179+ [ 'Sec-WebSocket-Extensions' , 'permessage-deflate; client_max_window_bits' ] ,
180+ [ 'Sec-WebSocket-Protocol' , 'subprotocol-a,subprotocol-b' ]
176181 ] ) ;
177182 } ) ;
178183
0 commit comments