Skip to content

Commit 8ceb8b0

Browse files
committed
always close response body
1 parent 80ffcd2 commit 8ceb8b0

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

internal/xrp/xrp.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,13 @@ func (c xrpClient) GetResponse(ctx context.Context, request xrpRequest) ([]byte,
160160
if err != nil {
161161
return nil, err
162162
}
163+
164+
defer func() {
165+
if err := resp.Body.Close(); err != nil {
166+
logger.Errorf("error closing response body: %v", err)
167+
}
168+
}()
169+
163170
if resp.StatusCode != http.StatusOK {
164171
return nil, errors.New("error response status")
165172
}

0 commit comments

Comments
 (0)