mirror of
https://github.com/continew-org/continew-starter.git
synced 2025-09-09 08:57:17 +08:00
fix(log): 修复构建请求可重复读流后过滤文件流导致的错误问题
This commit is contained in:
@@ -23,6 +23,7 @@ import jakarta.servlet.http.HttpServletRequest;
|
||||
import org.springframework.web.util.UriUtils;
|
||||
import top.continew.starter.core.constant.StringConstants;
|
||||
import top.continew.starter.log.http.RecordableHttpRequest;
|
||||
import top.continew.starter.web.util.RepeatReadRequestWrapper;
|
||||
|
||||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
@@ -79,8 +80,11 @@ public final class RecordableServletHttpRequest implements RecordableHttpRequest
|
||||
|
||||
@Override
|
||||
public String getBody() {
|
||||
String body = JakartaServletUtil.getBody(request);
|
||||
return JSONUtil.isTypeJSON(body) ? body : null;
|
||||
if (request instanceof RepeatReadRequestWrapper wrapper && !wrapper.isMultipartContent(request)) {
|
||||
String body = JakartaServletUtil.getBody(request);
|
||||
return JSONUtil.isTypeJSON(body) ? body : null;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -48,7 +48,13 @@ public class AccessLogUtils {
|
||||
}
|
||||
|
||||
// 参数为空返回空
|
||||
Map<String, Object> params = request.getParam();
|
||||
Map<String, Object> params;
|
||||
try {
|
||||
params = request.getParam();
|
||||
} catch (Exception e) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (ObjectUtil.isEmpty(params) || params.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
|
Reference in New Issue
Block a user