fix(pull): output HTTP logs when debug flag is used

Fixes #31098 by adding debug logging directly to the HTTPGetter, explicitly outputting the URL being fetched and the response URL along with the status code.

Signed-off-by: Dasmat13 <mey37056@gmail.com>
pull/32048/head
Dasmat13 3 months ago
parent d9a18b59a8
commit 6566b74f5e

@ -88,13 +88,17 @@ func (g *HTTPGetter) get(href string, opts getterOptions) (*bytes.Buffer, error)
return nil, err
}
slog.Debug("fetching", "url", href)
slog.Debug("fetching chart", "url", href)
resp, err := client.Do(req)
if err != nil {
return nil, err
}
defer resp.Body.Close()
slog.Debug("fetch complete", "url", href, "status", resp.Status, "content-length", resp.ContentLength)
if resp.Request != nil && resp.Request.URL != nil {
slog.Debug("chart fetch response", "url", resp.Request.URL.String(), "status", resp.Status, "content-length", resp.ContentLength)
} else {
slog.Debug("chart fetch response", "status", resp.Status, "content-length", resp.ContentLength)
}
if resp.StatusCode != http.StatusOK {
return nil, fmt.Errorf("failed to fetch %s : %s", href, resp.Status)
}

Loading…
Cancel
Save