From 89f9ef87e0532d54d086719c5ace1a968a42e51b Mon Sep 17 00:00:00 2001 From: "shaohui.tsh" Date: Thu, 7 Dec 2017 11:12:37 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0response=E8=87=AA?= =?UTF-8?q?=E5=A4=84=E7=90=86=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/http-proxy/passes/web-incoming.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/lib/http-proxy/passes/web-incoming.js b/lib/http-proxy/passes/web-incoming.js index 5cb0b03..2e72f31 100644 --- a/lib/http-proxy/passes/web-incoming.js +++ b/lib/http-proxy/passes/web-incoming.js @@ -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();