diff options
author | Max Denushev <mdenushev@ya.ru> | 2024-04-22 11:45:33 +0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-22 08:45:33 +0200 |
commit | 57b9352ad1cc93a0aaaa72b2130e03ace8a5b118 (patch) | |
tree | 2d70338e58a3243d05709b1fcd660cccc1ddcb94 /client.go | |
parent | refactor: do not return error as it is always nil (#1759) (diff) | |
download | fasthttp-57b9352ad1cc93a0aaaa72b2130e03ace8a5b118.tar.gz fasthttp-57b9352ad1cc93a0aaaa72b2130e03ace8a5b118.tar.bz2 fasthttp-57b9352ad1cc93a0aaaa72b2130e03ace8a5b118.zip |
* fix: propagate body stream error to close function (#1743)
* fix: http test
* fix: close body stream with error in encoding functions
* fix: lint
---------
Co-authored-by: Max Denushev <denushev@tochka.com>
Diffstat (limited to 'client.go')
-rw-r--r-- | client.go | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -2975,12 +2975,12 @@ func (t *transport) RoundTrip(hc *HostClient, req *Request, resp *Response) (ret closeConn := resetConnection || req.ConnectionClose() || resp.ConnectionClose() || isConnRST if customStreamBody && resp.bodyStream != nil { rbs := resp.bodyStream - resp.bodyStream = newCloseReader(rbs, func() error { + resp.bodyStream = newCloseReaderWithError(rbs, func(wErr error) error { hc.releaseReader(br) if r, ok := rbs.(*requestStream); ok { releaseRequestStream(r) } - if closeConn || resp.ConnectionClose() { + if closeConn || resp.ConnectionClose() || wErr != nil { hc.closeConn(cc) } else { hc.releaseConn(cc) |