From 0b7eea6dac5b624e653db1b237535a708bccfa71 Mon Sep 17 00:00:00 2001 From: Charles7c Date: Fri, 29 Dec 2023 22:48:44 +0800 Subject: [PATCH] =?UTF-8?q?fix(log/httptrace-pro):=20=E5=8F=96=E6=B6=88?= =?UTF-8?q?=E8=AE=B0=E5=BD=95=E9=9D=9E=20JSON=20=E6=A0=BC=E5=BC=8F?= =?UTF-8?q?=E8=AF=B7=E6=B1=82=E4=BD=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../httptracepro/handler/RecordableServletHttpRequest.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/continew-starter-log/continew-starter-log-httptrace-pro/src/main/java/top/charles7c/continew/starter/log/httptracepro/handler/RecordableServletHttpRequest.java b/continew-starter-log/continew-starter-log-httptrace-pro/src/main/java/top/charles7c/continew/starter/log/httptracepro/handler/RecordableServletHttpRequest.java index 8afd6134..87dc6895 100644 --- a/continew-starter-log/continew-starter-log-httptrace-pro/src/main/java/top/charles7c/continew/starter/log/httptracepro/handler/RecordableServletHttpRequest.java +++ b/continew-starter-log/continew-starter-log-httptrace-pro/src/main/java/top/charles7c/continew/starter/log/httptracepro/handler/RecordableServletHttpRequest.java @@ -80,9 +80,10 @@ public final class RecordableServletHttpRequest implements RecordableHttpRequest public String getBody() { ContentCachingRequestWrapper wrapper = WebUtils.getNativeRequest(request, ContentCachingRequestWrapper.class); if (null != wrapper) { - return StrUtil.utf8Str(wrapper.getContentAsByteArray()); + String body = StrUtil.utf8Str(wrapper.getContentAsByteArray()); + return JSONUtil.isTypeJSON(body) ? body : null; } - return StringConstants.EMPTY; + return null; } @Override