fix(接口测试): 修复json格式的请求数据冒号被替换成等号的缺陷
--bug=1021303 --user=王孝刚 【接口测试】github#20973,接口中JSON格式的数据请求中的:被系统替换成了=号 https://www.tapd.cn/55049933/s/1320278
This commit is contained in:
parent
1c6b8d4b78
commit
95ccae7283
|
@ -102,18 +102,19 @@ public class Body {
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
if (StringUtils.isNotEmpty(this.getRaw())) {
|
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());
|
List list = JSON.parseArray(this.getRaw());
|
||||||
if (!this.getRaw().contains("$ref")) {
|
if (!this.getRaw().contains("$ref")) {
|
||||||
jsonMockParse(list);
|
jsonMockParse(list);
|
||||||
}
|
}
|
||||||
this.raw = JSONUtil.parser(list.toString());
|
this.raw = JSONUtil.parser(JSONUtil.toJSONString(list));
|
||||||
} else {
|
} else {
|
||||||
Map<String, Object> map = JSON.parseObject(this.getRaw(), Map.class);
|
Map<String, Object> map = JSON.parseObject(this.getRaw(), Map.class);
|
||||||
if (!this.getRaw().contains("$ref")) {
|
if (!this.getRaw().contains("$ref")) {
|
||||||
jsonMockParse(map);
|
jsonMockParse(map);
|
||||||
}
|
}
|
||||||
this.raw = JSONUtil.parser(map.toString());
|
this.raw = JSONUtil.parser(JSONUtil.toJSONString(map));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|
Loading…
Reference in New Issue