fix(接口自动化): 修复http 协议输入参数无名称 校验

This commit is contained in:
fit2-zhao 2021-01-07 10:47:28 +08:00
parent 3bb9d4c8f1
commit cfa70bb622
2 changed files with 2 additions and 2 deletions

View File

@ -265,7 +265,7 @@ public class MsHTTPSamplerProxy extends MsTestElement {
private Arguments httpArguments(List<KeyValue> list) { private Arguments httpArguments(List<KeyValue> list) {
Arguments arguments = new Arguments(); Arguments arguments = new Arguments();
list.stream().filter(KeyValue::isValid).filter(KeyValue::isEnable).forEach(keyValue -> { list.stream().filter(KeyValue::isValid).filter(KeyValue::isEnable).forEach(keyValue -> {
HTTPArgument httpArgument = new HTTPArgument(keyValue.getName(), keyValue.getValue() != null && keyValue.getValue().startsWith("@") ? ScriptEngineUtils.calculate(keyValue.getValue()) : keyValue.getValue()); HTTPArgument httpArgument = new HTTPArgument(keyValue.getName(), StringUtils.isNotEmpty(keyValue.getValue()) && keyValue.getValue().startsWith("@") ? ScriptEngineUtils.calculate(keyValue.getValue()) : keyValue.getValue());
httpArgument.setAlwaysEncoded(keyValue.isEncode()); httpArgument.setAlwaysEncoded(keyValue.isEncode());
if (StringUtils.isNotBlank(keyValue.getContentType())) { if (StringUtils.isNotBlank(keyValue.getContentType())) {
httpArgument.setContentType(keyValue.getContentType()); httpArgument.setContentType(keyValue.getContentType());

View File

@ -49,7 +49,7 @@ public class KeyValue {
} }
public boolean isValid() { public boolean isValid() {
return (StringUtils.isNotBlank(name) || StringUtils.isNotBlank(value)) && !StringUtils.equalsIgnoreCase(type, "file"); return (StringUtils.isNotBlank(name) && StringUtils.isNotBlank(value)) && !StringUtils.equalsIgnoreCase(type, "file");
} }
public boolean isFile() { public boolean isFile() {