Skip to content

Commit

Permalink
fix: leaking response body upon PromptObject() error
Browse files Browse the repository at this point in the history
  • Loading branch information
harshavardhana committed Nov 2, 2024
1 parent 38922cc commit ab1c2fe
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions api-prompt-object.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,10 @@ func (c *Client) PromptObject(ctx context.Context, bucketName, objectName, promp
if err != nil {
return nil, err
}
if resp != nil {
if resp.StatusCode != http.StatusOK {
return nil, httpRespToErrorResponse(resp, bucketName, objectName)
}

if resp.StatusCode != http.StatusOK {
defer closeResponse(resp)
return nil, httpRespToErrorResponse(resp, bucketName, objectName)
}

return resp.Body, nil
Expand Down

0 comments on commit ab1c2fe

Please sign in to comment.