fix(接口自动化): 请求路径校验
This commit is contained in:
parent
3db39fb276
commit
75eeae71de
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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: {
|
||||
|
|
|
@ -542,7 +542,7 @@ export default {
|
|||
create_info: '创建',
|
||||
update_info: '更新',
|
||||
batch_edit: "批量编辑",
|
||||
path_valid_info: "请求地址不能包含空格",
|
||||
path_valid_info: "请求路径无效",
|
||||
}
|
||||
},
|
||||
automation: {
|
||||
|
|
|
@ -542,7 +542,7 @@ export default {
|
|||
create_info: '創建',
|
||||
update_info: '更新',
|
||||
batch_edit: "批量編輯",
|
||||
path_valid_info: "請求地址不能包含空格",
|
||||
path_valid_info: "請求路径无效",
|
||||
}
|
||||
},
|
||||
automation: {
|
||||
|
|
Loading…
Reference in New Issue