revert changes from #723

This commit is contained in:
☸️ 2021-05-02 00:56:38 +10:00 committed by GitHub
parent c38de3a511
commit 821ce9aea2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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)
}
}