From 584f9ad08cfe162f1c9a9e42802e0bd0a2284ea8 Mon Sep 17 00:00:00 2001 From: Valery Piashchynski Date: Tue, 16 Mar 2021 17:05:28 +0300 Subject: =?UTF-8?q?=F0=9F=90=9B=20fix=20issue=20with=20strange=20messages?= =?UTF-8?q?=20in=20the=20http=20body=20when=20max=20request=20reached?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Valery Piashchynski --- plugins/http/handler.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/plugins/http/handler.go b/plugins/http/handler.go index 11d9b827..b7c6f1fa 100644 --- a/plugins/http/handler.go +++ b/plugins/http/handler.go @@ -106,11 +106,10 @@ func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) { } if size > int64(h.maxRequestSize) { + h.sendEvent(ErrorEvent{Request: r, Error: errors.E(op, errors.Str("request body max size is exceeded")), start: start, elapsed: time.Since(start)}) http.Error(w, errors.E(op, errors.Str("request body max size is exceeded")).Error(), 500) + return } - - h.sendEvent(ErrorEvent{Request: r, Error: errors.E(op, errors.Str("request body max size is exceeded")), start: start, elapsed: time.Since(start)}) - return } } -- cgit v1.2.3