Skip to content

Commit 2620f06

Browse files
committed
[fix breaking] Emit the proxyResponse event on the HttpProxy instance to reduce listener churn and reference counts.
1 parent 701dc69 commit 2620f06

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

lib/node-http-proxy/http-proxy.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ HttpProxy.prototype.proxyRequest = function (req, res, buffer) {
318318
});
319319

320320
// Allow observer to modify headers or abort response
321-
try { req.emit('proxyResponse', req, res, response) }
321+
try { self.emit('proxyResponse', req, res, response) }
322322
catch (ex) {
323323
errState = true;
324324
return;

lib/node-http-proxy/routing-proxy.js

+1
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ RoutingProxy.prototype.add = function (options) {
116116
'start',
117117
'forward',
118118
'end',
119+
'proxyResponse',
119120
'websocket:start',
120121
'websocket:end',
121122
'websocket:incoming',

0 commit comments

Comments
 (0)