Merge pull request #7107 from wzshiming/fix/close-http-body

Fix missing closed HTTP Body
This commit is contained in:
Phil Estes 2022-06-28 08:54:02 -04:00 committed by GitHub
commit 36bd4a5178
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -182,6 +182,7 @@ func httpGetRequest(client *http.Client, request string) (io.ReadCloser, error)
return nil, err
}
if resp.StatusCode != 200 {
resp.Body.Close()
return nil, fmt.Errorf("http get failed with status: %s", resp.Status)
}
return resp.Body, nil