diff --git a/api-test/backend/src/main/java/io/metersphere/api/parse/HarScenarioAbstractParser.java b/api-test/backend/src/main/java/io/metersphere/api/parse/HarScenarioAbstractParser.java index f7af7e7177..9eb3f5bc28 100644 --- a/api-test/backend/src/main/java/io/metersphere/api/parse/HarScenarioAbstractParser.java +++ b/api-test/backend/src/main/java/io/metersphere/api/parse/HarScenarioAbstractParser.java @@ -32,6 +32,7 @@ public abstract class HarScenarioAbstractParser extends ApiImportAbstractPars } else { request.setPath("/"); } + request.setUrl(harRequest.url); parseParameters(harRequest, request); parseRequestBody(harRequest, request.getBody()); addBodyHeader(request); diff --git a/api-test/backend/src/main/java/io/metersphere/service/scenario/ApiScenarioService.java b/api-test/backend/src/main/java/io/metersphere/service/scenario/ApiScenarioService.java index 8a4e6b6fb3..7339cfd3ae 100644 --- a/api-test/backend/src/main/java/io/metersphere/service/scenario/ApiScenarioService.java +++ b/api-test/backend/src/main/java/io/metersphere/service/scenario/ApiScenarioService.java @@ -761,6 +761,7 @@ public class ApiScenarioService { Boolean enable = request.getEnvironmentEnable(); String scenarioDefinition = request.getDefinition(); JSONObject element = JSONUtil.parseObject(scenarioDefinition); + ElementUtil.dataFormatting(element); try { Map environmentMap = new HashMap<>(); if (BooleanUtils.isFalse(enable)) { diff --git a/api-test/frontend/src/business/automation/scenario/common/CustomizeReqInfo.vue b/api-test/frontend/src/business/automation/scenario/common/CustomizeReqInfo.vue index be1cefbe92..e9b017b57b 100644 --- a/api-test/frontend/src/business/automation/scenario/common/CustomizeReqInfo.vue +++ b/api-test/frontend/src/business/automation/scenario/common/CustomizeReqInfo.vue @@ -120,7 +120,7 @@ export default { }, setDomain() { let urlStr = this.addProtocol(this.request.url); - const reg = /(((^https?:(?:\/\/)?)(?:[-;:&=\+\$,\w]+@)?[A-Za-z0-9.-]+|(?:www.|[-;:&=\+\$,\w]+@)[A-Za-z0-9.-]+)((?:\/[\+~%\/.\w-_]*)?\??(?:[-\+=&;%@.\w_]*)#?(?:[\w]*))?)$/g; + const reg = /http(s)?:\/\/([\w-]+\.)+[\w-]+(\/[\w- .\/?%&=]*)?/; if (reg.test(urlStr)) { let url = this.getURL(urlStr); if (url && url.pathname) {