Skip to content

Commit

Permalink
fix handlingBodyManually
Browse files Browse the repository at this point in the history
  • Loading branch information
cachalots committed Nov 25, 2021
1 parent 2bd8821 commit 8017665
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -1438,9 +1438,17 @@ func (c *HostClient) doNonNilReqResp(req *Request, resp *Response) (bool, error)
}
}

if (!req.Header.IsGet() && req.Header.IsHead()) || req.HandlingBodyManually {
if !req.Header.IsGet() && req.Header.IsHead() {
resp.SkipBody = true
}

handlingBodyManually := req.HandlingBodyManually
if resp.mustSkipBody() {
handlingBodyManually = false
} else if req.HandlingBodyManually {
resp.SkipBody = true
}

if c.DisableHeaderNamesNormalizing {
resp.Header.DisableNormalizing()
}
Expand All @@ -1455,7 +1463,7 @@ func (c *HostClient) doNonNilReqResp(req *Request, resp *Response) (bool, error)
}

shouldClose := resetConnection || req.ConnectionClose() || resp.ConnectionClose()
if req.HandlingBodyManually {
if handlingBodyManually {
resp.manualBodyReader = c.manualBodyReadAccessor(br, cc, shouldClose)
} else {
c.releaseReader(br)
Expand Down

0 comments on commit 8017665

Please sign in to comment.