Permalink
Browse files

Allow event observers to access upstream response headers and data.

  • Loading branch information...
1 parent 9cecd97 commit 4c130f5dac5f2cfbfc2618446b86244aff4cb04f @colinmollenhour colinmollenhour committed with indexzero Dec 29, 2012
Showing with 2 additions and 1 deletion.
  1. +2 −1 lib/node-http-proxy/http-proxy.js
@@ -297,7 +297,7 @@ HttpProxy.prototype.proxyRequest = function (req, res, buffer) {
catch (ex) { console.error("res.end error: %s", ex.message) }
// Emit the `end` event now that we have completed proxying
- self.emit('end', req, res);
+ self.emit('end', req, res, response);
}
});
@@ -318,6 +318,7 @@ HttpProxy.prototype.proxyRequest = function (req, res, buffer) {
response.pause();
}
}
+ self.emit('data', chunk, req);
}
response.on('data', ondata);

0 comments on commit 4c130f5

Please sign in to comment.