From 8adb3bf69d9f63f182ceca3e7dd2413c7190628c Mon Sep 17 00:00:00 2001 From: song-tianyang Date: Tue, 22 Nov 2022 13:45:31 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=8E=A5=E5=8F=A3=E6=B5=8B=E8=AF=95):=20?= =?UTF-8?q?=E9=83=A8=E5=88=86=E8=AF=B7=E6=B1=82=E5=8C=B9=E9=85=8D=E4=B8=8D?= =?UTF-8?q?=E5=88=B0mock=E6=9C=9F=E6=9C=9B=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1019514 --user=宋天阳 【接口测试】附件里这个mock信息执行后匹配不到期望【+github#19549】 https://www.tapd.cn/55049933/s/1300813 --- .../java/io/metersphere/commons/utils/mock/MockApiUtils.java | 1 + 1 file changed, 1 insertion(+) 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 0e90b74690..ed7bcc604b 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 @@ -103,6 +103,7 @@ public class MockApiUtils { } else if (StringUtils.equalsIgnoreCase(type, "XML")) { if (bodyObj.has("raw")) { String xmlStr = bodyObj.optString("raw"); + xmlStr = xmlStr.replaceAll("\r","").replaceAll("\n",""); JSONObject matchObj = XMLUtil.xmlStringToJSONObject(xmlStr); returnJson = matchObj; }