Skip to content

Commit

Permalink
Ensure response body is always closed in CloudControllerConnection
Browse files Browse the repository at this point in the history
  • Loading branch information
chitoku-k authored and a-b committed Jun 14, 2023
1 parent a500264 commit 96c9db4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion api/cloudcontroller/cloud_controller_connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ func (*CloudControllerConnection) handleStatusCodes(response *http.Response, pas
passedResponse.RawResponse = []byte("{}")
} else {
rawBytes, err := ioutil.ReadAll(response.Body)
defer response.Body.Close()
if err != nil {
return err
}
Expand Down Expand Up @@ -105,6 +104,7 @@ func (*CloudControllerConnection) handleWarnings(response *http.Response) ([]str

func (connection *CloudControllerConnection) populateResponse(response *http.Response, passedResponse *Response) error {
passedResponse.HTTPResponse = response
defer response.Body.Close()

warnings, err := connection.handleWarnings(response)
if err != nil {
Expand Down

0 comments on commit 96c9db4

Please sign in to comment.