@@ -496,6 +496,11 @@ class ConfigurableProxy extends EventEmitter {
496
496
handleProxy ( kind , req , res ) {
497
497
// proxy any request
498
498
var that = this ;
499
+
500
+ // handleProxy is invoked by handleProxyWeb and handleProxyWs, which pass
501
+ // different arguments to handleProxy.
502
+ // - handleProxyWeb: args = [req, res]
503
+ // - handleProxyWs: args = [req, socket, head]
499
504
var args = Array . prototype . slice . call ( arguments , 1 ) ;
500
505
501
506
// get the proxy target
@@ -528,7 +533,9 @@ class ConfigurableProxy extends EventEmitter {
528
533
that . handleProxyError ( 503 , kind , req , res , e ) ;
529
534
} ) ;
530
535
531
- // dispatch the actual method
536
+ // dispatch the actual method, either:
537
+ // - proxy.web(req, res, options, errorHandler)
538
+ // - proxy.ws(req, socket, head, options, errorHandler)
532
539
that . proxy [ kind ] . apply ( that . proxy , args ) ;
533
540
534
541
// update timestamp on any request/reply data as well (this includes websocket data)
@@ -545,10 +552,10 @@ class ConfigurableProxy extends EventEmitter {
545
552
} ) ;
546
553
}
547
554
548
- handleProxyWs ( req , res , head ) {
555
+ handleProxyWs ( req , socket , head ) {
549
556
// Proxy a websocket request
550
557
this . statsd . increment ( "requests.ws" , 1 ) ;
551
- return this . handleProxy ( "ws" , req , res , head ) ;
558
+ return this . handleProxy ( "ws" , req , socket , head ) ;
552
559
}
553
560
554
561
handleProxyWeb ( req , res ) {
0 commit comments