fix(场景自动化): 修复引用场景请求头未生效问题

This commit is contained in:
fit2-zhao 2021-02-24 18:12:20 +08:00
parent 2b9a239d6c
commit 79780c8bac
1 changed files with 17 additions and 0 deletions

View File

@ -78,11 +78,28 @@ public class MsScenario extends MsTestElement {
JSONObject element = JSON.parseObject(scenario.getScenarioDefinition());
hashTree = mapper.readValue(element.getString("hashTree"), new TypeReference<LinkedList<MsTestElement>>() {
});
// 场景变量
if (StringUtils.isNotEmpty(element.getString("variables"))) {
LinkedList<ScenarioVariable> variables = mapper.readValue(element.getString("variables"),
new TypeReference<LinkedList<ScenarioVariable>>() {
});
this.setVariables(variables);
}
// 场景请求头
if (StringUtils.isNotEmpty(element.getString("headers"))) {
LinkedList<KeyValue> headers = mapper.readValue(element.getString("headers"),
new TypeReference<LinkedList<KeyValue>>() {
});
this.setHeaders(headers);
}
}
} catch (Exception ex) {
ex.printStackTrace();
}
}
// 设置共享cookie
config.setEnableCookieShare(enableCookieShare);
if (StringUtils.isNotEmpty(environmentId)) {
ApiTestEnvironmentService environmentService = CommonBeanFactory.getBean(ApiTestEnvironmentService.class);