Skip to content

Commit 69a6930

Browse files
committed
Merge pull request #735 from jleal52/master
Updated to support error callback on proxy.web and start/proxyReq/end co...
2 parents 709b3e9 + 9ba8311 commit 69a6930

File tree

2 files changed

+2
-6
lines changed

2 files changed

+2
-6
lines changed

lib/http-proxy/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ function createRightProxy(type) {
7777
* refer to the connection socket
7878
* pass(req, socket, options, head)
7979
*/
80-
if(passes[i](req, res, options, head, cbl ? false : this, cbl)) { // passes can return a truthy value to halt the loop
80+
if(passes[i](req, res, options, head, this, cbl)) { // passes can return a truthy value to halt the loop
8181
break;
8282
}
8383
}

lib/http-proxy/passes/web-incoming.js

+1-5
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,7 @@ web_o = Object.keys(web_o).map(function(pass) {
9292
function stream(req, res, options, _, server, clb) {
9393

9494
// And we begin!
95-
if (!clb) {
96-
server.emit('start', req, res, options.target)
97-
}
95+
server.emit('start', req, res, options.target)
9896
if(options.forward) {
9997
// If forward enable, so just pipe the request
10098
var forwardReq = (options.forward.protocol === 'https:' ? https : http).request(
@@ -151,9 +149,7 @@ web_o = Object.keys(web_o).map(function(pass) {
151149

152150
// Allow us to listen when the proxy has completed
153151
proxyRes.on('end', function () {
154-
if (!clb) {
155152
server.emit('end', req, res, proxyRes);
156-
}
157153
})
158154

159155
proxyRes.pipe(res);

0 commit comments

Comments
 (0)