From 29c7906250a9f38a3040a0a38e62db4f1f99a3a3 Mon Sep 17 00:00:00 2001 From: Paul Wells Date: Fri, 22 Nov 2024 00:42:49 -0800 Subject: [PATCH] skip http request logging when the client aborts the request (#3195) * skip http request logging when the client aborts the request * cleanup --- pkg/service/utils.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/service/utils.go b/pkg/service/utils.go index fd54197b2..bac2b395f 100644 --- a/pkg/service/utils.go +++ b/pkg/service/utils.go @@ -31,7 +31,7 @@ func handleError(w http.ResponseWriter, r *http.Request, status int, err error, if r != nil && r.URL != nil { keysAndValues = append(keysAndValues, "method", r.Method, "path", r.URL.Path) } - if !errors.Is(err, context.Canceled) { + if !errors.Is(err, context.Canceled) && !errors.Is(r.Context().Err(), context.Canceled) { logger.GetLogger().WithCallDepth(1).Warnw("error handling request", err, keysAndValues...) } w.WriteHeader(status)