From 1a079532e823e78ce35f8fe7f312e37e8cd0f902 Mon Sep 17 00:00:00 2001 From: RuoYi Date: Wed, 29 Apr 2020 21:14:12 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8F=AA=E5=AF=B9json=E7=B1=BB=E5=9E=8B?= =?UTF-8?q?=E8=AF=B7=E6=B1=82=E6=9E=84=E5=BB=BA=E5=8F=AF=E9=87=8D=E5=A4=8D?= =?UTF-8?q?=E8=AF=BB=E5=8F=96inputStream=E7=9A=84request?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/ruoyi/common/filter/RepeatableFilter.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ruoyi/src/main/java/com/ruoyi/common/filter/RepeatableFilter.java b/ruoyi/src/main/java/com/ruoyi/common/filter/RepeatableFilter.java index a1125e34..6e3edfce 100644 --- a/ruoyi/src/main/java/com/ruoyi/common/filter/RepeatableFilter.java +++ b/ruoyi/src/main/java/com/ruoyi/common/filter/RepeatableFilter.java @@ -8,6 +8,8 @@ import javax.servlet.ServletException; import javax.servlet.ServletRequest; import javax.servlet.ServletResponse; import javax.servlet.http.HttpServletRequest; +import org.springframework.http.MediaType; +import com.ruoyi.common.utils.StringUtils; /** * Repeatable 过滤器 @@ -27,7 +29,8 @@ public class RepeatableFilter implements Filter throws IOException, ServletException { ServletRequest requestWrapper = null; - if (request instanceof HttpServletRequest) + if (request instanceof HttpServletRequest && StringUtils.equalsAnyIgnoreCase(request.getContentType(), + MediaType.APPLICATION_JSON_VALUE, MediaType.APPLICATION_JSON_UTF8_VALUE)) { requestWrapper = new RepeatedlyRequestWrapper((HttpServletRequest) request, response); }