This commit is contained in:
chenjianxing 2020-12-17 16:14:16 +08:00
commit 556ddddd84
6 changed files with 32 additions and 12 deletions

View File

@ -80,6 +80,18 @@
if (!this.request.hashTree) {
this.request.hashTree = [];
}
//
if (this.response.body) {
let body = new Body();
Object.assign(body, this.response.body);
if (!body.binary) {
body.binary = [];
}
if (!body.kvs) {
body.kvs = [];
}
this.response.body = body;
}
},
methods: {
runTest(data) {

View File

@ -64,9 +64,9 @@
</el-col>
<!--<el-col v-if="type === 'body'" class="kv-select">-->
<!--<el-input :disabled="isReadOnly" v-model="item.contentType" size="small"-->
<!--@change="change" :placeholder="$t('api_test.request.content_type')" show-word-limit>-->
<!--</el-input>-->
<!--<el-input :disabled="isReadOnly" v-model="item.contentType" size="small"-->
<!--@change="change" :placeholder="$t('api_test.request.content_type')" show-word-limit>-->
<!--</el-input>-->
<!--</el-col>-->
<el-col class="kv-delete">

View File

@ -94,7 +94,7 @@
saveApi(saveAs) {
this.$refs['httpForm'].validate((valid) => {
if (valid) {
if(this.httpForm.path.match(/\s/)!=null){
if (this.httpForm.path && this.httpForm.path.match(/\s/) != null) {
this.$error(this.$t("api_test.definition.request.path_valid_info"));
return false;
}

View File

@ -182,11 +182,13 @@
if (!this.body.type) {
this.body.type = BODY_TYPE.FORM_DATA;
}
this.body.kvs.forEach(param => {
if (!param.type) {
param.type = 'text';
}
});
if (this.body.kvs) {
this.body.kvs.forEach(param => {
if (!param.type) {
param.type = 'text';
}
});
}
}
}
</script>

View File

@ -8,7 +8,7 @@
<ms-api-key-value :isShowEnable="false" :suggestions="headerSuggestions" :items="response.headers"/>
</el-tab-pane>
<el-tab-pane :label="$t('api_test.definition.request.response_body')" name="body" class="pane">
<ms-api-body :isShowEnable="false" :body="response.body" :headers="response.headers"/>
<ms-api-body :isReadOnly="false" :isShowEnable="false" :body="response.body" :headers="response.headers"/>
</el-tab-pane>
<el-tab-pane :label="$t('api_test.definition.request.status_code')" name="status_code" class="pane">

View File

@ -18,7 +18,7 @@ export const DEFAULT_DATA = [{
"name": "回收站",
"level": 1,
"children": [],
},{
}, {
"id": "root",
"name": "全部模块",
"level": 0,
@ -27,7 +27,13 @@ export const DEFAULT_DATA = [{
export const REQ_METHOD = [
{id: 'GET', label: 'GET'},
{id: 'POST', label: 'POST'}
{id: 'POST', label: 'POST'},
{id: 'PUT', label: 'PUT'},
{id: 'PATCH', label: 'PATCH'},
{id: 'DELETE', label: 'DELETE'},
{id: 'OPTIONS', label: 'OPTIONS'},
{id: 'HEAD', label: 'HEAD'},
{id: 'CONNECT', label: 'CONNECT'}
]
export const CASE_PRIORITY = [