Commit 1a079532e823e78ce35f8fe7f312e37e8cd0f902
1 parent
eec5c58b
只对json类型请求构建可重复读取inputStream的request
Showing
1 changed file
with
4 additions
and
1 deletions
ruoyi/src/main/java/com/ruoyi/common/filter/RepeatableFilter.java
| ... | ... | @@ -8,6 +8,8 @@ import javax.servlet.ServletException; |
| 8 | 8 | import javax.servlet.ServletRequest; |
| 9 | 9 | import javax.servlet.ServletResponse; |
| 10 | 10 | import javax.servlet.http.HttpServletRequest; |
| 11 | +import org.springframework.http.MediaType; | |
| 12 | +import com.ruoyi.common.utils.StringUtils; | |
| 11 | 13 | |
| 12 | 14 | /** |
| 13 | 15 | * Repeatable 过滤器 |
| ... | ... | @@ -27,7 +29,8 @@ public class RepeatableFilter implements Filter |
| 27 | 29 | throws IOException, ServletException |
| 28 | 30 | { |
| 29 | 31 | ServletRequest requestWrapper = null; |
| 30 | - if (request instanceof HttpServletRequest) | |
| 32 | + if (request instanceof HttpServletRequest && StringUtils.equalsAnyIgnoreCase(request.getContentType(), | |
| 33 | + MediaType.APPLICATION_JSON_VALUE, MediaType.APPLICATION_JSON_UTF8_VALUE)) | |
| 31 | 34 | { |
| 32 | 35 | requestWrapper = new RepeatedlyRequestWrapper((HttpServletRequest) request, response); |
| 33 | 36 | } | ... | ... |