diff --git a/backend/src/main/java/io/metersphere/api/dto/definition/request/MsScenario.java b/backend/src/main/java/io/metersphere/api/dto/definition/request/MsScenario.java index c77efb653b..175345cb1b 100644 --- a/backend/src/main/java/io/metersphere/api/dto/definition/request/MsScenario.java +++ b/backend/src/main/java/io/metersphere/api/dto/definition/request/MsScenario.java @@ -78,11 +78,28 @@ public class MsScenario extends MsTestElement { JSONObject element = JSON.parseObject(scenario.getScenarioDefinition()); hashTree = mapper.readValue(element.getString("hashTree"), new TypeReference>() { }); + // 场景变量 + if (StringUtils.isNotEmpty(element.getString("variables"))) { + LinkedList variables = mapper.readValue(element.getString("variables"), + new TypeReference>() { + }); + this.setVariables(variables); + } + // 场景请求头 + if (StringUtils.isNotEmpty(element.getString("headers"))) { + LinkedList headers = mapper.readValue(element.getString("headers"), + new TypeReference>() { + }); + this.setHeaders(headers); + } + } + } catch (Exception ex) { ex.printStackTrace(); } } + // 设置共享cookie config.setEnableCookieShare(enableCookieShare); if (StringUtils.isNotEmpty(environmentId)) { ApiTestEnvironmentService environmentService = CommonBeanFactory.getBean(ApiTestEnvironmentService.class);