fix(接口测试): 修复json格式的请求数据冒号被替换成等号的缺陷

--bug=1021303 --user=王孝刚 【接口测试】github#20973,接口中JSON格式的数据请求中的:被系统替换成了=号
https://www.tapd.cn/55049933/s/1320278
This commit is contained in:
wxg0103 2022-12-28 11:54:23 +08:00 committed by wxg0103
parent 1c6b8d4b78
commit 95ccae7283
1 changed files with 4 additions and 3 deletions

View File

@ -102,18 +102,19 @@ public class Body {
} else {
try {
if (StringUtils.isNotEmpty(this.getRaw())) {
if (StringUtils.startsWith(this.getRaw(), "[") && StringUtils.endsWith(this.raw, "]")) {
String value = StringUtils.chomp(this.getRaw().trim());
if (StringUtils.startsWith(value, "[") && StringUtils.endsWith(value, "]")) {
List list = JSON.parseArray(this.getRaw());
if (!this.getRaw().contains("$ref")) {
jsonMockParse(list);
}
this.raw = JSONUtil.parser(list.toString());
this.raw = JSONUtil.parser(JSONUtil.toJSONString(list));
} else {
Map<String, Object> map = JSON.parseObject(this.getRaw(), Map.class);
if (!this.getRaw().contains("$ref")) {
jsonMockParse(map);
}
this.raw = JSONUtil.parser(map.toString());
this.raw = JSONUtil.parser(JSONUtil.toJSONString(map));
}
}
} catch (Exception e) {