mirror of
https://github.com/Xevion/banner.git
synced 2025-12-15 06:11:11 -06:00
Close response body I/O properly
This commit is contained in:
1
api.go
1
api.go
@@ -274,6 +274,7 @@ func Search(query *Query, sort string, sortDescending bool) (*SearchResult, erro
|
||||
log.Error().Stack().Str("content-type", res.Header.Get("Content-Type")).Msg("Response was not JSON")
|
||||
}
|
||||
|
||||
defer res.Body.Close()
|
||||
body, err := io.ReadAll(res.Body)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to read response body: %w", err)
|
||||
|
||||
Reference in New Issue
Block a user