Skip to content

Commit 551f637

Browse files
committed
docstrings for handleProxy function
1 parent 8eaede3 commit 551f637

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

lib/configproxy.js

+10-3
Original file line numberDiff line numberDiff line change
@@ -496,6 +496,11 @@ class ConfigurableProxy extends EventEmitter {
496496
handleProxy(kind, req, res) {
497497
// proxy any request
498498
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]
499504
var args = Array.prototype.slice.call(arguments, 1);
500505

501506
// get the proxy target
@@ -528,7 +533,9 @@ class ConfigurableProxy extends EventEmitter {
528533
that.handleProxyError(503, kind, req, res, e);
529534
});
530535

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)
532539
that.proxy[kind].apply(that.proxy, args);
533540

534541
// update timestamp on any request/reply data as well (this includes websocket data)
@@ -545,10 +552,10 @@ class ConfigurableProxy extends EventEmitter {
545552
});
546553
}
547554

548-
handleProxyWs(req, res, head) {
555+
handleProxyWs(req, socket, head) {
549556
// Proxy a websocket request
550557
this.statsd.increment("requests.ws", 1);
551-
return this.handleProxy("ws", req, res, head);
558+
return this.handleProxy("ws", req, socket, head);
552559
}
553560

554561
handleProxyWeb(req, res) {

0 commit comments

Comments
 (0)