fix: rewrite content-length header when returning decompressed body

pull/188/head v2.0.7
xingpeng 2021-04-15 13:59:47 +08:00 committed by kun
parent 258f7b0440
commit 236ffb4996
1 changed files with 2 additions and 0 deletions

View File

@ -58,6 +58,8 @@ func (router *Router) customModResponse(r *http.Response) error {
return err
}
r.Header.Del("Content-Encoding")
// rewrite content-length header due to the decompressed data will be refilled in the body
r.Header.Set("Content-Length", fmt.Sprint(len(buf)))
} else {
buf, err = ioutil.ReadAll(r.Body)
if err != nil {