diff --git a/frontend/src/business/components/api/definition/components/complete/EditCompleteHTTPApi.vue b/frontend/src/business/components/api/definition/components/complete/EditCompleteHTTPApi.vue index bbb7d76635..cbfac1cf9f 100644 --- a/frontend/src/business/components/api/definition/components/complete/EditCompleteHTTPApi.vue +++ b/frontend/src/business/components/api/definition/components/complete/EditCompleteHTTPApi.vue @@ -100,13 +100,18 @@ name: "MsAddCompleteHttpApi", components: {MsResponseText, MsApiRequestForm, MsJsr233Processor}, data() { + let validateURL = (rule, value, callback) => { + if (!this.httpForm.path.startsWith("/") || this.httpForm.path.match(/\s/) != null) { + callback(this.$t('api_test.definition.request.path_valid_info')); + } + }; return { rule: { name: [ {required: true, message: this.$t('test_track.case.input_name'), trigger: 'blur'}, {max: 50, message: this.$t('test_track.length_less_than') + '50', trigger: 'blur'} ], - path: [{required: true, message: this.$t('api_test.definition.request.path_info'), trigger: 'blur'}], + path: [{required: true, message: this.$t('api_test.definition.request.path_info'), trigger: 'blur'}, {validator: validateURL, trigger: 'blur'}], userId: [{required: true, message: this.$t('test_track.case.input_maintainer'), trigger: 'change'}], moduleId: [{required: true, message: this.$t('test_track.case.input_module'), trigger: 'change'}], status: [{required: true, message: this.$t('commons.please_select'), trigger: 'change'}], @@ -124,10 +129,6 @@ runTest() { this.$refs['httpForm'].validate((valid) => { if (valid) { - if(this.httpForm.path.match(/\s/)!=null){ - this.$error(this.$t("api_test.definition.request.path_valid_info")); - return false; - } this.setParameter(); this.$emit('runTest', this.httpForm); } else { @@ -150,10 +151,6 @@ saveApi() { this.$refs['httpForm'].validate((valid) => { if (valid) { - if(this.httpForm.path.match(/\s/)!=null){ - this.$error(this.$t("api_test.definition.request.path_valid_info")); - return false; - } this.setParameter(); this.$emit('saveApi', this.httpForm); } diff --git a/frontend/src/i18n/en-US.js b/frontend/src/i18n/en-US.js index 98297db031..675c403610 100644 --- a/frontend/src/i18n/en-US.js +++ b/frontend/src/i18n/en-US.js @@ -543,7 +543,7 @@ export default { create_info: 'Create', update_info: 'Update', batch_edit: "Batch edit", - path_valid_info: "The request address cannot contain spaces", + path_valid_info: "The request path is invalid", } }, automation: { diff --git a/frontend/src/i18n/zh-CN.js b/frontend/src/i18n/zh-CN.js index e9bde643d8..465d4d9c9a 100644 --- a/frontend/src/i18n/zh-CN.js +++ b/frontend/src/i18n/zh-CN.js @@ -542,7 +542,7 @@ export default { create_info: '创建', update_info: '更新', batch_edit: "批量编辑", - path_valid_info: "请求地址不能包含空格", + path_valid_info: "请求路径无效", } }, automation: { diff --git a/frontend/src/i18n/zh-TW.js b/frontend/src/i18n/zh-TW.js index 70711b87c7..c7c05280ed 100644 --- a/frontend/src/i18n/zh-TW.js +++ b/frontend/src/i18n/zh-TW.js @@ -542,7 +542,7 @@ export default { create_info: '創建', update_info: '更新', batch_edit: "批量編輯", - path_valid_info: "請求地址不能包含空格", + path_valid_info: "請求路径无效", } }, automation: {