From baa8cc27a343f565891078a1b287f9f95d3e4db1 Mon Sep 17 00:00:00 2001 From: MeterSphere Bot <78466014+metersphere-bot@users.noreply.github.com> Date: Fri, 26 Aug 2022 13:42:53 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=8E=A5=E5=8F=A3=E5=AE=9A=E4=B9=89):=20?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=9C=BA=E6=99=AF=E8=87=AA=E5=AE=9A=E4=B9=89?= =?UTF-8?q?=E8=AF=B7=E6=B1=82=E5=BC=95=E7=94=A8=E7=8E=AF=E5=A2=83=E6=8B=BC?= =?UTF-8?q?=E6=8E=A5url=E6=9C=89=E9=97=AE=E9=A2=98=E7=9A=84=E7=BC=BA?= =?UTF-8?q?=E9=99=B7=20(#17462)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: wxg0103 <727495428@qq.com> --- .../scenario/common/CustomizeReqInfo.vue | 22 +++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) 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 9e41846f81..6fcfa3ef05 100644 --- a/frontend/src/business/components/api/automation/scenario/common/CustomizeReqInfo.vue +++ b/frontend/src/business/components/api/automation/scenario/common/CustomizeReqInfo.vue @@ -5,14 +5,17 @@ - + + style="width: 50%" size="small" @blur="urlChange" :disabled="request.disabled" + v-if="request.isRefEnvironment"/> - + {{ $t('api_test.request.refer_to_environment') }} @@ -20,7 +23,8 @@ - + @@ -115,6 +119,16 @@ 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; + if (reg.test(urlStr)) { + let url = this.getURL(urlStr); + if (url && url.pathname) { + this.request.path = url.pathname; + } + } else { + this.request.path = this.request.url + } this.$emit("setDomain"); } }