Skip to content

Commit

Permalink
fix(log/interceptor): 修复全局配置和局部配置包含请求、响应体冲突
Browse files Browse the repository at this point in the history
  • Loading branch information
Charles7c committed Sep 24, 2024
1 parent 3535ac6 commit be4dec5
Showing 1 changed file with 2 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,12 @@
import org.springframework.web.util.ContentCachingRequestWrapper;
import org.springframework.web.util.ContentCachingResponseWrapper;
import org.springframework.web.util.WebUtils;
import top.continew.starter.log.core.enums.Include;
import top.continew.starter.log.interceptor.autoconfigure.LogProperties;

import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.Objects;
import java.util.Set;

/**
* 日志过滤器
Expand Down Expand Up @@ -123,9 +121,7 @@ private boolean isRequestValid(HttpServletRequest request) {
* @return true:是;false:否
*/
private boolean isRequestWrapper(HttpServletRequest request) {
Set<Include> includeSet = logProperties.getIncludes();
return !(request instanceof ContentCachingRequestWrapper) && (includeSet
.contains(Include.REQUEST_BODY) || includeSet.contains(Include.REQUEST_PARAM));
return !(request instanceof ContentCachingRequestWrapper);
}

/**
Expand All @@ -135,9 +131,7 @@ private boolean isRequestWrapper(HttpServletRequest request) {
* @return true:是;false:否
*/
private boolean isResponseWrapper(HttpServletResponse response) {
Set<Include> includeSet = logProperties.getIncludes();
return !(response instanceof ContentCachingResponseWrapper) && (includeSet
.contains(Include.RESPONSE_BODY) || includeSet.contains(Include.RESPONSE_PARAM));
return !(response instanceof ContentCachingResponseWrapper);
}

/**
Expand Down

0 comments on commit be4dec5

Please sign in to comment.