fix(接口自动化): JSON断言特殊符号处理
This commit is contained in:
parent
78b30352af
commit
9cdadf67ee
|
@ -15,7 +15,6 @@ import io.metersphere.api.service.ApiTestEnvironmentService;
|
||||||
import io.metersphere.base.domain.ApiScenarioWithBLOBs;
|
import io.metersphere.base.domain.ApiScenarioWithBLOBs;
|
||||||
import io.metersphere.base.domain.ApiTestEnvironmentWithBLOBs;
|
import io.metersphere.base.domain.ApiTestEnvironmentWithBLOBs;
|
||||||
import io.metersphere.commons.utils.CommonBeanFactory;
|
import io.metersphere.commons.utils.CommonBeanFactory;
|
||||||
import io.metersphere.commons.utils.ScriptEngineUtils;
|
|
||||||
import io.metersphere.commons.utils.SessionUtils;
|
import io.metersphere.commons.utils.SessionUtils;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
|
@ -108,7 +107,7 @@ public class MsScenario extends MsTestElement {
|
||||||
}
|
}
|
||||||
// 设置共享cookie
|
// 设置共享cookie
|
||||||
config.setEnableCookieShare(enableCookieShare);
|
config.setEnableCookieShare(enableCookieShare);
|
||||||
Map<String,EnvironmentConfig> envConfig = new HashMap<>(16);
|
Map<String, EnvironmentConfig> envConfig = new HashMap<>(16);
|
||||||
// 兼容历史数据
|
// 兼容历史数据
|
||||||
if (environmentMap == null || environmentMap.isEmpty()) {
|
if (environmentMap == null || environmentMap.isEmpty()) {
|
||||||
environmentMap = new HashMap<>(16);
|
environmentMap = new HashMap<>(16);
|
||||||
|
@ -167,7 +166,9 @@ public class MsScenario extends MsTestElement {
|
||||||
headers.stream().filter(KeyValue::isValid).filter(KeyValue::isEnable).forEach(keyValue ->
|
headers.stream().filter(KeyValue::isValid).filter(KeyValue::isEnable).forEach(keyValue ->
|
||||||
headerManager.add(new Header(keyValue.getName(), keyValue.getValue()))
|
headerManager.add(new Header(keyValue.getName(), keyValue.getValue()))
|
||||||
);
|
);
|
||||||
tree.add(headerManager);
|
if (headerManager.getHeaders().size() > 0) {
|
||||||
|
tree.add(headerManager);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -178,7 +178,9 @@ public abstract class MsTestElement {
|
||||||
config.getConfig().get(this.getProjectId()).getCommonConfig().getVariables().stream().filter(KeyValue::isValid).filter(KeyValue::isEnable).forEach(keyValue ->
|
config.getConfig().get(this.getProjectId()).getCommonConfig().getVariables().stream().filter(KeyValue::isValid).filter(KeyValue::isEnable).forEach(keyValue ->
|
||||||
arguments.addArgument(keyValue.getName(), keyValue.getValue(), "=")
|
arguments.addArgument(keyValue.getName(), keyValue.getValue(), "=")
|
||||||
);
|
);
|
||||||
return arguments;
|
if (arguments.getArguments().size() > 0) {
|
||||||
|
return arguments;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -96,7 +96,7 @@ public class MsAssertions extends MsTestElement {
|
||||||
assertion.setJsonValidationBool(true);
|
assertion.setJsonValidationBool(true);
|
||||||
assertion.setExpectNull(false);
|
assertion.setExpectNull(false);
|
||||||
assertion.setInvert(false);
|
assertion.setInvert(false);
|
||||||
assertion.setIsRegex(true);
|
assertion.setIsRegex(false);
|
||||||
return assertion;
|
return assertion;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue