@@ -407,6 +407,43 @@ describe('lib/http-proxy.js', function() {
407
407
408
408
} ) ;
409
409
410
-
410
+ it ( 'should pass all set-cookie headers to client' , function ( done ) {
411
+ var ports = { source : gen . port , proxy : gen . port } ;
412
+ var proxy = httpProxy . createProxyServer ( {
413
+ target : 'ws://127.0.0.1:' + ports . source ,
414
+ ws : true
415
+ } ) ,
416
+ proxyServer = proxy . listen ( ports . proxy ) ,
417
+ destiny = new ws . Server ( { port : ports . source } , function ( ) {
418
+ var key = new Buffer ( Math . random ( ) . toString ( 35 ) ) . toString ( 'base64' ) ;
419
+
420
+ var requestOptions = {
421
+ port : ports . proxy ,
422
+ host : '127.0.0.1' ,
423
+ headers : {
424
+ 'Connection' : 'Upgrade' ,
425
+ 'Upgrade' : 'websocket' ,
426
+ 'Host' : 'ws://127.0.0.1' ,
427
+ 'Sec-WebSocket-Version' : 13 ,
428
+ 'Sec-WebSocket-Key' : key
429
+ }
430
+ } ;
431
+
432
+ var req = http . request ( requestOptions ) ;
433
+
434
+ req . on ( 'upgrade' , function ( res , socket , upgradeHead ) {
435
+ expect ( res . headers [ 'set-cookie' ] . length ) . to . be ( 2 ) ;
436
+ done ( ) ;
437
+ } ) ;
438
+
439
+ req . end ( ) ;
440
+ } ) ;
441
+
442
+ destiny . on ( 'headers' , function ( headers ) {
443
+ headers . push ( 'Set-Cookie: test1=test1' ) ;
444
+ headers . push ( 'Set-Cookie: test2=test2' ) ;
445
+ } ) ;
446
+ } ) ;
447
+
411
448
} )
412
449
} ) ;
0 commit comments