Skip to content

Commit 89f9ef8

Browse files
shaohui.tshindexzero
shaohui.tsh
authored andcommitted
feat: 添加response自处理参数
1 parent c5d8466 commit 89f9ef8

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

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

+7-4
Original file line numberDiff line numberDiff line change
@@ -162,16 +162,19 @@ module.exports = {
162162

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

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

174-
proxyRes.pipe(res);
171+
if(!options.selfHandleResponse) {
172+
for(var i=0; i < web_o.length; i++) {
173+
if(web_o[i](req, res, proxyRes, options)) { break; }
174+
}
175+
176+
proxyRes.pipe(res);
177+
}
175178
});
176179

177180
//proxyReq.end();

0 commit comments

Comments
 (0)