fix: close resp body (bodyclose)

Signed-off-by: Babak K. Shandiz <babakks@github.com>
This commit is contained in:
Babak K. Shandiz 2025-11-03 14:24:39 +00:00
parent d129b94fc5
commit 9f65e89760
No known key found for this signature in database
GPG key ID: 9472CAEFF56C742E
2 changed files with 5 additions and 0 deletions

View file

@ -1549,6 +1549,8 @@ func RepoExists(client *Client, repo ghrepo.Interface) (bool, error) {
return false, err
}
defer resp.Body.Close()
switch resp.StatusCode {
case 200:
return true, nil

View file

@ -526,6 +526,8 @@ func getTopics(ctx context.Context, httpClient *http.Client, repo ghrepo.Interfa
if err != nil {
return nil, err
}
defer res.Body.Close()
if res.StatusCode != http.StatusOK {
return nil, api.HandleHTTPError(res)
}
@ -563,6 +565,7 @@ func setTopics(ctx context.Context, httpClient *http.Client, repo ghrepo.Interfa
if err != nil {
return err
}
defer res.Body.Close()
if res.StatusCode != http.StatusOK {
return api.HandleHTTPError(res)