From 821ce9aea2600c55fcae25501233d44ee891600c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=98=B8=EF=B8=8F?= <29265684+buffermet@users.noreply.github.com> Date: Sun, 2 May 2021 00:56:38 +1000 Subject: [PATCH] revert changes from #723 --- modules/http_proxy/http_proxy_base_filters.go | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/modules/http_proxy/http_proxy_base_filters.go b/modules/http_proxy/http_proxy_base_filters.go index 4cfb6b88..017fc0c3 100644 --- a/modules/http_proxy/http_proxy_base_filters.go +++ b/modules/http_proxy/http_proxy_base_filters.go @@ -116,13 +116,7 @@ func (p *HTTPProxy) onResponseFilter(res *http.Response, ctx *goproxy.ProxyCtx) if jsres != nil { // the response has been changed by the script p.logResponseAction(res.Request, jsres) - raw, err := ioutil.ReadAll(jsres.ToResponse(res.Request).Body) - if err == nil { - html := string(raw) - res.Header.Set("Content-Length", strconv.Itoa(len(html))) - // reset the response body to the original unread state - res.Body = ioutil.NopCloser(strings.NewReader(html)) - } + return jsres.ToResponse(res.Request) } }