Skip to content

Commit 3d4e9bc

Browse files
authoredFeb 2, 2021
fix: add request error log for other handlers (#8)
1 parent e7a301b commit 3d4e9bc

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed
 

‎pkg/http/api/v1/handler.go

+2
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ func (h *requestHandler) scan(res http.ResponseWriter, req *http.Request) {
6565
var scanRequest harbor.ScanRequest
6666
err := json.NewDecoder(req.Body).Decode(&scanRequest)
6767
if err != nil {
68+
h.logRequestError(req, err)
6869
res.Header().Set("Content-Type", harbor.ScanAdapterErrorMimeType)
6970
res.WriteHeader(http.StatusBadRequest)
7071
json.NewEncoder(res).Encode(
@@ -91,6 +92,7 @@ func (h *requestHandler) getReport(res http.ResponseWriter, req *http.Request) {
9192

9293
vulnerabilityReport, err := h.adapter.GetVulnerabilityReport(vars["scan_request_id"])
9394
if err != nil {
95+
h.logRequestError(req, err)
9496
switch err {
9597
case scanner.ErrScanRequestIDNotFound:
9698
res.WriteHeader(http.StatusNotFound)

0 commit comments

Comments
 (0)
Please sign in to comment.