From 6ced16f46195f591570cb6b17c6055b61bb72330 Mon Sep 17 00:00:00 2001 From: song-tianyang Date: Thu, 30 Mar 2023 18:21:27 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=8E=A5=E5=8F=A3=E6=B5=8B=E8=AF=95):=20mo?= =?UTF-8?q?ck=E6=9C=9F=E6=9C=9B=E6=94=AF=E6=8C=81=E5=8C=B9=E9=85=8Dcontent?= =?UTF-8?q?-type=E4=B8=BAapplication/xml=E7=9A=84=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1024996 --user=宋天阳 【接口测试】github#23293,接口测试】-mock后置脚本-不支持获取content-type类型application/xml的xml数据 https://www.tapd.cn/55049933/s/1357826 --- .../java/io/metersphere/commons/utils/mock/MockApiUtils.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api-test/backend/src/main/java/io/metersphere/commons/utils/mock/MockApiUtils.java b/api-test/backend/src/main/java/io/metersphere/commons/utils/mock/MockApiUtils.java index 4b9d37a92e..f13b31db27 100644 --- a/api-test/backend/src/main/java/io/metersphere/commons/utils/mock/MockApiUtils.java +++ b/api-test/backend/src/main/java/io/metersphere/commons/utils/mock/MockApiUtils.java @@ -371,7 +371,7 @@ public class MockApiUtils { } catch (Exception e) { LogUtil.error(e); } - } else if (StringUtils.startsWithIgnoreCase(request.getContentType(), "text/xml")) { + } else if (StringUtils.startsWithIgnoreCase(request.getContentType(), "text/xml") || StringUtils.startsWithIgnoreCase(request.getContentType(), "application/xml")) { mockParams.setParamType(MockRequestType.XML.name()); String xmlString = readXml(request); JSONObject xmlJsonObject = XMLUtil.xmlStringToJSONObject(xmlString);