fix(接口测试): 部分请求匹配不到mock期望的问题

--bug=1019514 --user=宋天阳 【接口测试】附件里这个mock信息执行后匹配不到期望【+github#19549】
https://www.tapd.cn/55049933/s/1300813
This commit is contained in:
song-tianyang 2022-11-22 13:45:31 +08:00 committed by 建国
parent e2a8f99301
commit 8adb3bf69d
1 changed files with 1 additions and 0 deletions

View File

@ -103,6 +103,7 @@ public class MockApiUtils {
} else if (StringUtils.equalsIgnoreCase(type, "XML")) { } else if (StringUtils.equalsIgnoreCase(type, "XML")) {
if (bodyObj.has("raw")) { if (bodyObj.has("raw")) {
String xmlStr = bodyObj.optString("raw"); String xmlStr = bodyObj.optString("raw");
xmlStr = xmlStr.replaceAll("\r","").replaceAll("\n","");
JSONObject matchObj = XMLUtil.xmlStringToJSONObject(xmlStr); JSONObject matchObj = XMLUtil.xmlStringToJSONObject(xmlStr);
returnJson = matchObj; returnJson = matchObj;
} }