fix(接口自动化): 修复JSON 格式数据请求问题
This commit is contained in:
parent
bcbc9e5a53
commit
869b66e551
|
@ -42,11 +42,13 @@ public class Body {
|
|||
return true;
|
||||
} else return false;
|
||||
}
|
||||
|
||||
public boolean isOldKV() {
|
||||
if (StringUtils.equals(type, KV)) {
|
||||
return true;
|
||||
} else return false;
|
||||
}
|
||||
|
||||
public List<KeyValue> getBodyParams(HTTPSamplerProxy sampler, String requestId) {
|
||||
List<KeyValue> body = new ArrayList<>();
|
||||
if (this.isKV() || this.isBinary()) {
|
||||
|
@ -65,7 +67,7 @@ public class Body {
|
|||
this.raw = JSONSchemaGenerator.getJson(com.alibaba.fastjson.JSON.toJSONString(this.getJsonSchema()));
|
||||
}
|
||||
}
|
||||
KeyValue keyValue = new KeyValue("", this.getRaw());
|
||||
KeyValue keyValue = new KeyValue("", "JSON-SCHEMA", this.getRaw(), true, true);
|
||||
keyValue.setEnable(true);
|
||||
keyValue.setEncode(false);
|
||||
body.add(keyValue);
|
||||
|
|
|
@ -31,6 +31,14 @@ public class KeyValue {
|
|||
this(name, value, description, null);
|
||||
}
|
||||
|
||||
public KeyValue(String name, String type, String value, boolean required, boolean enable) {
|
||||
this.name = name;
|
||||
this.type = type;
|
||||
this.value = value;
|
||||
this.required = required;
|
||||
this.enable = enable;
|
||||
}
|
||||
|
||||
public KeyValue(String name, String value, String description, String contentType) {
|
||||
this(name, value, description, contentType, true);
|
||||
}
|
||||
|
@ -49,7 +57,7 @@ public class KeyValue {
|
|||
}
|
||||
|
||||
public boolean isValid() {
|
||||
return (StringUtils.isNotBlank(name) && StringUtils.isNotBlank(value)) && !StringUtils.equalsIgnoreCase(type, "file");
|
||||
return ((StringUtils.isNotBlank(name) && StringUtils.isNotBlank(value)) || "JSON-SCHEMA".equals(type)) && !StringUtils.equalsIgnoreCase(type, "file");
|
||||
}
|
||||
|
||||
public boolean isFile() {
|
||||
|
|
Loading…
Reference in New Issue