mirror of
https://github.com/minio/minio.git
synced 2025-02-04 02:15:59 -05:00
madmin: close http response when returning an error (#6526)
httpRespToErrorResponse() usually reads the http response when the http error code is not expected to parse the json error response in the http body, however it was never properly closing the connection. This PR fixes the behavior.
This commit is contained in:
parent
ce1bfa6de8
commit
20378821cf
@ -73,6 +73,7 @@ func httpRespToErrorResponse(resp *http.Response) error {
|
||||
Message: "Failed to parse server response.",
|
||||
}
|
||||
}
|
||||
closeResponse(resp)
|
||||
return errResp
|
||||
}
|
||||
|
||||
|
@ -92,7 +92,6 @@ func (adm *AdminClient) DownloadProfilingData() (io.ReadCloser, error) {
|
||||
}
|
||||
|
||||
if resp.StatusCode != http.StatusOK {
|
||||
closeResponse(resp)
|
||||
return nil, httpRespToErrorResponse(resp)
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user