mirror of
https://github.com/http-party/node-http-proxy.git
synced 2025-12-08 20:59:18 +00:00
feat: 添加response自处理参数
This commit is contained in:
parent
c5d8466483
commit
89f9ef87e0
@ -162,16 +162,19 @@ module.exports = {
|
|||||||
|
|
||||||
proxyReq.on('response', function(proxyRes) {
|
proxyReq.on('response', function(proxyRes) {
|
||||||
if(server) { server.emit('proxyRes', proxyRes, req, res); }
|
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
|
// Allow us to listen when the proxy has completed
|
||||||
proxyRes.on('end', function () {
|
proxyRes.on('end', function () {
|
||||||
server.emit('end', req, res, proxyRes);
|
server.emit('end', req, res, proxyRes);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if(!options.selfHandleResponse) {
|
||||||
|
for(var i=0; i < web_o.length; i++) {
|
||||||
|
if(web_o[i](req, res, proxyRes, options)) { break; }
|
||||||
|
}
|
||||||
|
|
||||||
proxyRes.pipe(res);
|
proxyRes.pipe(res);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
//proxyReq.end();
|
//proxyReq.end();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user