优化防重复提交拦截器,非JSON格式不获取Body消息体

This commit is contained in:
RuoYi 2020-08-10 17:24:11 +08:00
parent 5901fc6610
commit 8bbe60975a

View File

@ -53,8 +53,7 @@ public class SameUrlDataInterceptor extends RepeatSubmitInterceptor
public boolean isRepeatSubmit(HttpServletRequest request) public boolean isRepeatSubmit(HttpServletRequest request)
{ {
String nowParams = ""; String nowParams = "";
if (request instanceof HttpServletRequest && StringUtils.equalsAnyIgnoreCase(request.getContentType(), if (request instanceof RepeatedlyRequestWrapper)
MediaType.APPLICATION_JSON_VALUE, MediaType.APPLICATION_JSON_UTF8_VALUE))
{ {
RepeatedlyRequestWrapper repeatedlyRequest = (RepeatedlyRequestWrapper) request; RepeatedlyRequestWrapper repeatedlyRequest = (RepeatedlyRequestWrapper) request;
nowParams = HttpHelper.getBodyString(repeatedlyRequest); nowParams = HttpHelper.getBodyString(repeatedlyRequest);