Skip to content
This repository was archived by the owner on Jan 8, 2019. It is now read-only.

Commit 433a1a6

Browse files
committed
Do not emit proxyRes event when server is false. Work around http-party#548
1 parent 2c8edc1 commit 433a1a6

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

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

+3-1
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,9 @@ web_o = Object.keys(web_o).map(function(pass) {
117117
(options.buffer || req).pipe(proxyReq);
118118

119119
proxyReq.on('response', function(proxyRes) {
120-
server.emit('proxyRes', proxyRes);
120+
if (server) { // Workaround for https://github.com/nodejitsu/node-http-proxy/issues/548
121+
server.emit('proxyRes', proxyRes);
122+
}
121123
for(var i=0; i < web_o.length; i++) {
122124
if(web_o[i](req, res, proxyRes)) { break; }
123125
}

0 commit comments

Comments
 (0)