fix(log/httptrace-pro): 取消记录非 JSON 格式请求体

This commit is contained in:
2023-12-29 22:48:44 +08:00
parent 52dce2acdf
commit 0b7eea6dac

View File

@@ -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