Only emit response if a valid server is present

This commit is contained in:
Mike Moulton 2014-01-14 00:45:42 -07:00
parent 2c8edc170d
commit 969a623542

View File

@ -117,7 +117,7 @@ web_o = Object.keys(web_o).map(function(pass) {
(options.buffer || req).pipe(proxyReq);
proxyReq.on('response', function(proxyRes) {
server.emit('proxyRes', proxyRes);
if(server) { server.emit('proxyRes', proxyRes); }
for(var i=0; i < web_o.length; i++) {
if(web_o[i](req, res, proxyRes)) { break; }
}