diff --git a/internal/artifact/artifact.go b/internal/artifact/artifact.go index 91ecbcf897b19886087c9a9361236f814f4e9869..9677b21c1c43e5e002620b568a24817b6438b579 100644 --- a/internal/artifact/artifact.go +++ b/internal/artifact/artifact.go @@ -96,6 +96,8 @@ func (a *Artifact) makeRequest(w http.ResponseWriter, r *http.Request, reqURL *u return } + defer resp.Body.Close() + if additionalHandler(resp) { return } diff --git a/internal/source/gitlab/client/client.go b/internal/source/gitlab/client/client.go index afe9da6f8a06205378bc6d629bc322d13adaa009..6d2fa28c5870b33210a8863eedc92b326cac7cd7 100644 --- a/internal/source/gitlab/client/client.go +++ b/internal/source/gitlab/client/client.go @@ -88,9 +88,13 @@ func (gc *Client) GetLookup(ctx context.Context, host string) api.Lookup { lookup := api.Lookup{Name: host} lookup.Error = json.NewDecoder(resp.Body).Decode(&lookup.Domain) + resp.Body.Close() + return lookup } +// get returns the response object +// the caller is responsible for closing the response body func (gc *Client) get(ctx context.Context, path string, params url.Values) (*http.Response, error) { endpoint, err := gc.endpoint(path, params) if err != nil {