Fix missing closed HTTP Body

Signed-off-by: Shiming Zhang <wzshiming@foxmail.com>
This commit is contained in:
Shiming Zhang 2022-06-28 14:47:26 +08:00
parent b76544b8f5
commit 0a240ff811

View File

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