Skip to content

Commit

Permalink
feat: 添加response自处理参数
Browse files Browse the repository at this point in the history
  • Loading branch information
shaohui.tsh authored and indexzero committed Apr 20, 2018
1 parent c5d8466 commit 89f9ef8
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions lib/http-proxy/passes/web-incoming.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,16 +162,19 @@ module.exports = {

proxyReq.on('response', function(proxyRes) {
if(server) { server.emit('proxyRes', proxyRes, req, res); }
for(var i=0; i < web_o.length; i++) {
if(web_o[i](req, res, proxyRes, options)) { break; }
}

// Allow us to listen when the proxy has completed
proxyRes.on('end', function () {
server.emit('end', req, res, proxyRes);
});

proxyRes.pipe(res);
if(!options.selfHandleResponse) {
for(var i=0; i < web_o.length; i++) {
if(web_o[i](req, res, proxyRes, options)) { break; }
}

proxyRes.pipe(res);
}
});

//proxyReq.end();
Expand Down

0 comments on commit 89f9ef8

Please sign in to comment.