internal/client: add additional context to HTTP error message

Add HTTP method and request URL to error message for unexpected
status code when accessing vulndb.

For golang/go#62603

Change-Id: I7789b6eb81d2d580a62a4d4f38c9d02667b6a365
Reviewed-on: https://go-review.googlesource.com/c/vuln/+/528215
Reviewed-by: Zvonimir Pavlinovic <zpavlinovic@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
diff --git a/internal/client/source.go b/internal/client/source.go
index 3e47b09..2e848c3 100644
--- a/internal/client/source.go
+++ b/internal/client/source.go
@@ -45,8 +45,9 @@
 func (hs *httpSource) get(ctx context.Context, endpoint string) (_ []byte, err error) {
 	derrors.Wrap(&err, "get(%s)", endpoint)
 
+	method := http.MethodGet
 	reqURL := fmt.Sprintf("%s/%s", hs.url, endpoint+".json.gz")
-	req, err := http.NewRequestWithContext(ctx, http.MethodGet, reqURL, nil)
+	req, err := http.NewRequestWithContext(ctx, method, reqURL, nil)
 	if err != nil {
 		return nil, err
 	}
@@ -56,7 +57,7 @@
 	}
 	defer resp.Body.Close()
 	if resp.StatusCode != http.StatusOK {
-		return nil, fmt.Errorf("unexpected HTTP status code: %d", resp.StatusCode)
+		return nil, fmt.Errorf("HTTP %s %s returned unexpected status: %s", method, reqURL, resp.Status)
 	}
 
 	// Uncompress the result.