client: Close connection for unsuccessful responses
This commit is contained in:
parent
48fa6a724e
commit
c8626bae17
@ -82,6 +82,8 @@ func ReadResponse(rc io.ReadCloser) (*Response, error) {
|
|||||||
|
|
||||||
if resp.Status.Class() == StatusClassSuccess {
|
if resp.Status.Class() == StatusClassSuccess {
|
||||||
resp.Body = newReadCloserBody(br, rc)
|
resp.Body = newReadCloserBody(br, rc)
|
||||||
|
} else {
|
||||||
|
rc.Close()
|
||||||
}
|
}
|
||||||
return resp, nil
|
return resp, nil
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user