Skip to content

Commit

Permalink
fix: close res body
Browse files Browse the repository at this point in the history
  • Loading branch information
testwill authored May 10, 2024
1 parent b711325 commit dcf932c
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions internal/itorrents/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ func (c client) Get(ctx context.Context, hash20 protocol.ID) (metainfo.TorrentFi
if resErr != nil {
return metainfo.TorrentFile{}, fmt.Errorf("failed to request torrent file: %w", reqErr)
}
defer res.Body.Close()
if res.StatusCode != http.StatusOK {
return metainfo.TorrentFile{}, fmt.Errorf("response status was not OK requesting torrent file: %s", res.Status)
}
Expand Down

0 comments on commit dcf932c

Please sign in to comment.