From 7cfa0767d17d961bb5051d4215716f614277c452 Mon Sep 17 00:00:00 2001 From: AgAngle <1323481023@qq.com> Date: Tue, 24 Dec 2024 12:42:04 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=8E=A5=E5=8F=A3=E6=B5=8B=E8=AF=95):=20mo?= =?UTF-8?q?ck=E5=8C=B9=E9=85=8D=E6=9C=89=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/io/metersphere/api/utils/MockServerUtils.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/backend/services/api-test/src/main/java/io/metersphere/api/utils/MockServerUtils.java b/backend/services/api-test/src/main/java/io/metersphere/api/utils/MockServerUtils.java index af6221732c..1dfa0173be 100644 --- a/backend/services/api-test/src/main/java/io/metersphere/api/utils/MockServerUtils.java +++ b/backend/services/api-test/src/main/java/io/metersphere/api/utils/MockServerUtils.java @@ -6,6 +6,7 @@ import io.metersphere.api.dto.request.http.body.Body; import io.metersphere.sdk.util.JSON; import io.metersphere.sdk.util.LogUtils; import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletRequestWrapper; import jakarta.servlet.http.Part; import org.apache.commons.lang3.StringUtils; import org.apache.shiro.web.servlet.ShiroHttpServletRequest; @@ -45,6 +46,9 @@ public class MockServerUtils { String requestPostString = null; try { + if (request instanceof HttpServletRequestWrapper requestWrapper) { + request = (HttpServletRequest) requestWrapper.getRequest(); + } if (request instanceof ShiroHttpServletRequest shiroHttpServletRequest) { String contentType = StringUtils.isBlank(request.getContentType()) ? StringUtils.EMPTY : request.getContentType(); List contentTypeLists = List.of(MediaType.APPLICATION_JSON_VALUE, MediaType.APPLICATION_XML_VALUE, MediaType.TEXT_XML_VALUE, MediaType.TEXT_PLAIN_VALUE);