fix(接口定义): 修复接口没有用例时初始添加报错问题
This commit is contained in:
parent
e8f56b1787
commit
13adca8f57
|
@ -222,7 +222,9 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
this.result = this.$post("/api/testcase/list", this.condition, response => {
|
this.result = this.$post("/api/testcase/list", this.condition, response => {
|
||||||
this.apiCaseList = response.data;
|
if(response.data){
|
||||||
|
this.apiCaseList = response.data;
|
||||||
|
}
|
||||||
this.apiCaseList.forEach(apiCase => {
|
this.apiCaseList.forEach(apiCase => {
|
||||||
if (apiCase.tags && apiCase.tags.length > 0) {
|
if (apiCase.tags && apiCase.tags.length > 0) {
|
||||||
apiCase.tags = JSON.parse(apiCase.tags);
|
apiCase.tags = JSON.parse(apiCase.tags);
|
||||||
|
@ -236,7 +238,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
})
|
})
|
||||||
if (!this.useEnvironment && this.apiCaseList[0].request && this.apiCaseList[0].request.useEnvironment) {
|
if (!this.useEnvironment && this.apiCaseList[0] && this.apiCaseList[0].request && this.apiCaseList[0].request.useEnvironment) {
|
||||||
this.useEnvironment = this.apiCaseList[0].request.useEnvironment;
|
this.useEnvironment = this.apiCaseList[0].request.useEnvironment;
|
||||||
this.environment = this.useEnvironment;
|
this.environment = this.useEnvironment;
|
||||||
}
|
}
|
||||||
|
|
|
@ -524,7 +524,8 @@ export default {
|
||||||
this.$emit('editApi', row);
|
this.$emit('editApi', row);
|
||||||
},
|
},
|
||||||
runApi(row) {
|
runApi(row) {
|
||||||
let request = JSON.parse(row.request);
|
|
||||||
|
let request = row ? JSON.parse(row.request) : {};
|
||||||
if (row.tags instanceof Array) {
|
if (row.tags instanceof Array) {
|
||||||
row.tags = JSON.stringify(row.tags);
|
row.tags = JSON.stringify(row.tags);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue