Fix Agent handling of gzipped responses (#7470)

* Fix Agent handling of gzipped responses

Fixes #6606

* Only remove "gzip" member, if present

* Simplify to just removing Accept-Encoding altogether
This commit is contained in:
Jim Kalafut 2019-09-18 14:24:41 -07:00 committed by Brian Kassouf
parent 73b9e39775
commit 3621179560

View file

@ -36,6 +36,11 @@ func (ap *APIProxy) Send(ctx context.Context, req *SendRequest) (*SendResponse,
return nil, err return nil, err
} }
client.SetToken(req.Token) client.SetToken(req.Token)
// http.Transport will transparently request gzip and decompress the response, but only if
// the client doesn't manually set the header. Removing any Accept-Encoding header allows the
// transparent compression to occur.
req.Request.Header.Del("Accept-Encoding")
client.SetHeaders(req.Request.Header) client.SetHeaders(req.Request.Header)
fwReq := client.NewRequest(req.Request.Method, req.Request.URL.Path) fwReq := client.NewRequest(req.Request.Method, req.Request.URL.Path)