mirror of
https://github.com/valyala/fasthttp.git
synced 2026-06-14 15:56:44 +03:00
Propagating custom SkipBody value to allow explicitly skip body reading for responses (#647)
This commit is contained in:
committed by
Erik Dubbelboer
parent
8ce231e840
commit
4fa45fadd2
@@ -1143,7 +1143,11 @@ func (c *HostClient) doNonNilReqResp(req *Request, resp *Response) (bool, error)
|
||||
|
||||
// Free up resources occupied by response before sending the request,
|
||||
// so the GC may reclaim these resources (e.g. response body).
|
||||
|
||||
// backing up SkipBody in case it was set explicitly
|
||||
customSkipBody := resp.SkipBody
|
||||
resp.Reset()
|
||||
resp.SkipBody = customSkipBody
|
||||
|
||||
// If we detected a redirect to another schema
|
||||
if req.schemaUpdate {
|
||||
@@ -1210,7 +1214,7 @@ func (c *HostClient) doNonNilReqResp(req *Request, resp *Response) (bool, error)
|
||||
}
|
||||
}
|
||||
|
||||
if !req.Header.IsGet() && req.Header.IsHead() {
|
||||
if customSkipBody || !req.Header.IsGet() && req.Header.IsHead() {
|
||||
resp.SkipBody = true
|
||||
}
|
||||
if c.DisableHeaderNamesNormalizing {
|
||||
|
||||
Reference in New Issue
Block a user