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 a765701cb4..ce755e41e0 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 @@ -312,7 +312,7 @@ public class MsHTTPSamplerProxy extends MsTestElement { sampler.setPort(urlObject.getPort()); } sampler.setProtocol(urlObject.getProtocol()); - sampler.setPath(URLDecoder.decode(URLEncoder.encode(urlObject.getPath(), "UTF-8"), "UTF-8")); + sampler.setPath(URLDecoder.decode(URLEncoder.encode(urlObject.getFile(), "UTF-8"), "UTF-8")); } catch (Exception e) { LogUtil.error(e.getMessage(), e); } @@ -324,7 +324,7 @@ public class MsHTTPSamplerProxy extends MsTestElement { String envPath = ""; if (!isCustomizeReqCompleteUrl(this.path)) { URL urlObject = new URL(url); - envPath = StringUtils.equals(urlObject.getPath(), "/") ? "" : urlObject.getPath(); + envPath = StringUtils.equals(urlObject.getPath(), "/") ? "" : urlObject.getFile(); if (StringUtils.isNotBlank(this.getPath())) { envPath += this.getPath(); } @@ -338,7 +338,7 @@ public class MsHTTPSamplerProxy extends MsTestElement { sampler.setPort(httpConfig.getPort()); } else { URL urlObject = new URL(this.path); - envPath = StringUtils.equals(urlObject.getPath(), "/") ? "" : urlObject.getPath(); + envPath = StringUtils.equals(urlObject.getPath(), "/") ? "" : urlObject.getFile(); sampler.setDomain(URLDecoder.decode(urlObject.getHost(), "UTF-8")); sampler.setProtocol(urlObject.getProtocol()); } @@ -385,7 +385,7 @@ public class MsHTTPSamplerProxy extends MsTestElement { sampler.setPort(urlObject.getPort()); } sampler.setProtocol(urlObject.getProtocol()); - String envPath = StringUtils.equals(urlObject.getPath(), "/") ? "" : urlObject.getPath(); + String envPath = StringUtils.equals(urlObject.getPath(), "/") ? "" : urlObject.getFile(); sampler.setPath(envPath); if (CollectionUtils.isNotEmpty(this.getRest()) && this.isRest()) { envPath = getRestParameters(URLDecoder.decode(URLEncoder.encode(envPath, "UTF-8"), "UTF-8")); diff --git a/backend/src/main/java/io/metersphere/api/service/ApiAutomationService.java b/backend/src/main/java/io/metersphere/api/service/ApiAutomationService.java index fdcb0b2072..42baaf15a2 100644 --- a/backend/src/main/java/io/metersphere/api/service/ApiAutomationService.java +++ b/backend/src/main/java/io/metersphere/api/service/ApiAutomationService.java @@ -1040,7 +1040,9 @@ public class ApiAutomationService { public void run() { List reportIds = new LinkedList<>(); for (APIScenarioReportResult key : map.keySet()) { - key.setExecuteType(ExecuteType.Marge.name()); + if (StringUtils.isNotEmpty(serialReportId)) { + key.setExecuteType(ExecuteType.Marge.name()); + } apiScenarioReportMapper.insert(key); reportIds.add(key.getId()); try { diff --git a/frontend/src/business/components/api/automation/scenario/common/CustomizeReqInfo.vue b/frontend/src/business/components/api/automation/scenario/common/CustomizeReqInfo.vue index 83bdefb580..4cd3c9974c 100644 --- a/frontend/src/business/components/api/automation/scenario/common/CustomizeReqInfo.vue +++ b/frontend/src/business/components/api/automation/scenario/common/CustomizeReqInfo.vue @@ -13,7 +13,7 @@ - {{$t('api_test.request.refer_to_environment')}} + {{ $t('api_test.request.refer_to_environment') }}
@@ -45,6 +45,7 @@ export default { data() { return { reqOptions: REQ_METHOD, + isUrl: false, } }, mounted() { @@ -69,20 +70,25 @@ export default { }, methods: { pathChange() { + this.isUrl = false; if (!this.request.path || this.request.path.indexOf('?') === -1) return; let url = this.getURL(this.addProtocol(this.request.path)); - if (url) { + if (url && this.isUrl) { this.request.path = decodeURIComponent(this.request.path.substr(0, this.request.path.indexOf("?"))); } }, urlChange() { + this.isUrl = false; if (this.isCustomizeReq) { this.request.path = this.request.url; } if (!this.request.url || this.request.url.indexOf('?') === -1) return; let url = this.getURL(this.addProtocol(this.request.url)); if (url) { - this.request.url = decodeURIComponent(this.request.url.substr(0, this.request.url.indexOf("?"))); + let paramUrl = this.request.url.substr(this.request.url.indexOf("?") + 1); + if (paramUrl && this.isUrl) { + this.request.url = decodeURIComponent(this.request.url.substr(0, this.request.url.indexOf("?"))); + } } }, addProtocol(url) { @@ -98,6 +104,7 @@ export default { let url = new URL(urlStr); url.searchParams.forEach((value, key) => { if (key && value) { + this.isUrl = true; this.request.arguments.splice(0, 0, new KeyValue({name: key, required: false, value: value})); } }); @@ -111,11 +118,11 @@ export default {