fix: add debug logging to HTTP getter for helm pull

When running 'helm pull --debug', no debug output was printed because
the HTTP getter did not emit any slog.Debug messages. This adds
slog.Debug calls to log the URL being fetched and the response status
when debug-level logging is enabled.

Fixes helm/helm#31098

Signed-off-by: Cairon <cairon-ab@users.noreply.github.com>
pull/32034/head
Cairon 3 days ago
parent cf69a6ef70
commit c26be60d81

@ -20,6 +20,7 @@ import (
"crypto/tls"
"fmt"
"io"
"log/slog"
"net/http"
"net/url"
"sync"
@ -87,11 +88,13 @@ func (g *HTTPGetter) get(href string, opts getterOptions) (*bytes.Buffer, error)
return nil, err
}
slog.Debug("fetching", "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.StatusCode != http.StatusOK {
return nil, fmt.Errorf("failed to fetch %s : %s", href, resp.Status)
}

Loading…
Cancel
Save