diff --git a/backend/src/main/java/io/metersphere/api/dto/automation/parse/HarScenarioParser.java b/backend/src/main/java/io/metersphere/api/dto/automation/parse/HarScenarioParser.java index a21c3fcbd3..13a73b9a1f 100644 --- a/backend/src/main/java/io/metersphere/api/dto/automation/parse/HarScenarioParser.java +++ b/backend/src/main/java/io/metersphere/api/dto/automation/parse/HarScenarioParser.java @@ -85,7 +85,6 @@ public class HarScenarioParser extends HarScenarioAbstractParser if (request != null) { results.add(request); } - request.setRequestResult(getRequestResult(request,item)); } scenario.setHashTree(results); } diff --git a/backend/src/main/java/io/metersphere/api/dto/definition/request/controller/MsIfController.java b/backend/src/main/java/io/metersphere/api/dto/definition/request/controller/MsIfController.java index 9cdfd39e4b..bcd8b26a4f 100644 --- a/backend/src/main/java/io/metersphere/api/dto/definition/request/controller/MsIfController.java +++ b/backend/src/main/java/io/metersphere/api/dto/definition/request/controller/MsIfController.java @@ -77,25 +77,29 @@ public class MsIfController extends MsTestElement { } public String getContentValue() { - String content = this.variable; - Pattern regex = Pattern.compile("\\$\\{([^}]*)\\}"); - Matcher matcher = regex.matcher(content); - StringBuilder stringBuilder = new StringBuilder(); - while (matcher.find()) { - stringBuilder.append(matcher.group(1) + ","); + try { + String content = this.variable; + Pattern regex = Pattern.compile("\\$\\{([^}]*)\\}"); + Matcher matcher = regex.matcher(content); + StringBuilder stringBuilder = new StringBuilder(); + while (matcher.find()) { + stringBuilder.append(matcher.group(1) + ","); + } + if (stringBuilder.length() > 0) { + stringBuilder.deleteCharAt(stringBuilder.length() - 1); + } + if (StringUtils.isEmpty(stringBuilder.toString())) { + return this.variable; + } + return stringBuilder.toString(); + } catch (Exception e) { + return null; } - if (stringBuilder.length() > 0) { - stringBuilder.deleteCharAt(stringBuilder.length() - 1); - } - if (StringUtils.isEmpty(stringBuilder.toString())) { - return this.variable; - } - return stringBuilder.toString(); } public String getCondition() { String key = getContentValue(); - String variable = key.equals(this.variable) ? "\"" + this.variable + "\"" : "vars.get('" + key + "')"; + String variable = (StringUtils.isEmpty(key) || key.equals(this.variable)) ? "\"" + this.variable + "\"" : "vars.get('" + key + "')"; String operator = this.operator; String value; if (StringUtils.equals(operator, "<") || StringUtils.equals(operator, ">")) { diff --git a/backend/src/main/java/io/metersphere/api/dto/definition/request/sampler/MsHTTPSamplerProxy.java b/backend/src/main/java/io/metersphere/api/dto/definition/request/sampler/MsHTTPSamplerProxy.java index 724f1942f4..a765701cb4 100644 --- a/backend/src/main/java/io/metersphere/api/dto/definition/request/sampler/MsHTTPSamplerProxy.java +++ b/backend/src/main/java/io/metersphere/api/dto/definition/request/sampler/MsHTTPSamplerProxy.java @@ -109,9 +109,6 @@ public class MsHTTPSamplerProxy extends MsTestElement { @JSONField(ordinal = 34) private List arguments; - @JSONField(ordinal = 35) - private Object requestResult; - @JSONField(ordinal = 36) private MsAuthManager authManager;