fix(接口测试): 优化swagger响应体的校验方式

--bug=1046351 --user=宋天阳 【接口测试】github#33025,接口定义通过swagger导入,swagger中ResponseResult中有《》这个符号就会报错,报数据解析错误,V2和V3的最新版本均有这个问题 https://www.tapd.cn/55049933/s/1578840
This commit is contained in:
Jianguo-Genius 2024-09-14 15:57:01 +08:00 committed by 刘瑞斌
parent 36242372f1
commit bfaa4994d8
1 changed files with 6 additions and 2 deletions

View File

@ -316,8 +316,12 @@ public class Swagger3ParserApiDefinition extends HttpApiDefinitionImportAbstract
case MediaType.APPLICATION_XML_VALUE -> {
body.setBodyType(Body.BodyType.XML.name());
XmlBody xml = new XmlBody();
String xmlBody = parseXmlBody(value, jsonSchemaItem);
xml.setValue(xmlBody);
try {
String xmlBody = parseXmlBody(value, jsonSchemaItem);
xml.setValue(xmlBody);
} catch (Exception e) {
xml.setValue(e.getMessage());
}
body.setXmlBody(xml);
}
case MediaType.MULTIPART_FORM_DATA_VALUE -> {