fix: logging for remote network calls (#3140)

Signed-off-by: Keith Zantow <kzantow@gmail.com>
This commit is contained in:
Keith Zantow
2024-08-20 11:45:33 -04:00
committed by GitHub
parent 511cc9c2d5
commit 95b4a88256
3 changed files with 20 additions and 5 deletions
+3 -3
View File
@@ -178,13 +178,13 @@ func formatNpmRegistryURL(baseURL, packageName, version string) (requestURL stri
return requestURL, nil
}
func getLicenseFromNpmRegistry(basURL, packageName, version string) (string, error) {
func getLicenseFromNpmRegistry(baseURL, packageName, version string) (string, error) {
// "https://registry.npmjs.org/%s/%s", packageName, version
requestURL, err := formatNpmRegistryURL(basURL, packageName, version)
requestURL, err := formatNpmRegistryURL(baseURL, packageName, version)
if err != nil {
return "", fmt.Errorf("unable to format npm request for pkg:version %s%s; %w", packageName, version, err)
}
log.Tracef("trying to fetch remote package %s", requestURL)
log.WithFields("url", requestURL).Info("downloading javascript package from npm")
npmRequest, err := http.NewRequest(http.MethodGet, requestURL, nil)
if err != nil {