fix: 请求体选xml等格式还是jsonSchema
This commit is contained in:
parent
2f7b69ef27
commit
441e33722f
|
@ -81,13 +81,15 @@ public class Body {
|
||||||
|
|
||||||
private void parseJonBodyMock() {
|
private void parseJonBodyMock() {
|
||||||
try {
|
try {
|
||||||
if(StringUtils.isNotEmpty(this.format) && this.getJsonSchema() != null
|
if (StringUtils.isNotBlank(this.type) && StringUtils.equals(this.type, "JSON")) {
|
||||||
&& "JSON-SCHEMA".equals(this.format)) {
|
if(StringUtils.isNotEmpty(this.format) && this.getJsonSchema() != null
|
||||||
this.raw = JSONSchemaGenerator.getJson(com.alibaba.fastjson.JSON.toJSONString(this.getJsonSchema()));
|
&& "JSON-SCHEMA".equals(this.format)) {
|
||||||
} else if (StringUtils.isNotBlank(this.type) && StringUtils.equals(this.type, "JSON")) { // json 文本也支持 mock 参数
|
this.raw = JSONSchemaGenerator.getJson(com.alibaba.fastjson.JSON.toJSONString(this.getJsonSchema()));
|
||||||
JSONObject jsonObject = com.alibaba.fastjson.JSON.parseObject(this.getRaw());
|
} else { // json 文本也支持 mock 参数
|
||||||
jsonMockParse(jsonObject);
|
JSONObject jsonObject = com.alibaba.fastjson.JSON.parseObject(this.getRaw());
|
||||||
this.raw = JSONObject.toJSONString(jsonObject);
|
jsonMockParse(jsonObject);
|
||||||
|
this.raw = JSONObject.toJSONString(jsonObject);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LogUtil.error(e.getMessage(), e);
|
LogUtil.error(e.getMessage(), e);
|
||||||
|
|
Loading…
Reference in New Issue