diff --git a/lib/snyk/package.go b/lib/snyk/package.go index 5037ddc..61f4c24 100644 --- a/lib/snyk/package.go +++ b/lib/snyk/package.go @@ -18,6 +18,8 @@ package snyk import ( "context" + "fmt" + "net/http" "github.com/deepmap/oapi-codegen/pkg/securityprovider" "github.com/google/uuid" @@ -96,5 +98,9 @@ func GetPackageVulnerabilities(purl *packageurl.PackageURL, auth *securityprovid return nil, err } + if resp.StatusCode() != http.StatusOK { + return resp, fmt.Errorf("unsuccessful request (%s)", resp.Status()) + } + return resp, nil }