From d954b8d82805b306a0900d00e024bbf66e4c0f95 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9F=D0=B0=D0=B2=D0=B5=D0=BB=20=D0=9A=D0=BE=D0=BC=D0=B8?= =?UTF-8?q?=D1=81=D1=81=D0=B0=D1=80=D0=BE=D0=B2?= Date: Mon, 28 Apr 2025 15:08:59 +0300 Subject: [PATCH] =?UTF-8?q?MSP-2267=20=D0=B2=D1=8B=D0=B2=D0=B5=D0=BB=20?= =?UTF-8?q?=D0=B2=20=D0=BA=D0=BE=D0=BD=D1=81=D1=82=D0=B0=D0=BD=D1=82=D1=83?= =?UTF-8?q?=20=D0=BF=D1=80=D0=B5=D1=84=D0=B8=D0=BA=D1=81=20=D0=B4=D0=BB?= =?UTF-8?q?=D1=8F=20=D0=BF=D0=BE=D0=B8=D1=81=D0=BA=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- middleware/logger.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/middleware/logger.go b/middleware/logger.go index 0c63060..fccdf45 100644 --- a/middleware/logger.go +++ b/middleware/logger.go @@ -15,6 +15,10 @@ import ( "isp-gate-service/request" ) +var ( + unicodeEscapePrefix = []byte("\\u") // nolint:gochecknoglobals +) + type scSource interface { StatusCode() int } @@ -110,7 +114,7 @@ func Logger( // nolint:gocognit } if logBodyFromCurrenRequest { - if enableForceUnescapingUnicode && bytes.Contains(buf.RequestBody(), []byte("\\u")) { + if enableForceUnescapingUnicode && bytes.Contains(buf.RequestBody(), unicodeEscapePrefix) { fields = append(fields, log.ByteString("request", forceUnescapingUnicode(buf.RequestBody()))) } else { fields = append(fields, log.ByteString("request", buf.RequestBody()))