Skip to content

Commit 4c130f5

Browse files
colinmollenhourindexzero
authored andcommitted
Allow event observers to access upstream response headers and data.
1 parent 9cecd97 commit 4c130f5

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

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

+2-1
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ HttpProxy.prototype.proxyRequest = function (req, res, buffer) {
297297
catch (ex) { console.error("res.end error: %s", ex.message) }
298298

299299
// Emit the `end` event now that we have completed proxying
300-
self.emit('end', req, res);
300+
self.emit('end', req, res, response);
301301
}
302302
});
303303

@@ -318,6 +318,7 @@ HttpProxy.prototype.proxyRequest = function (req, res, buffer) {
318318
response.pause();
319319
}
320320
}
321+
self.emit('data', chunk, req);
321322
}
322323

323324
response.on('data', ondata);

0 commit comments

Comments
 (0)