fix (接口测试): 执行结果解析错误问题修复

This commit is contained in:
fit2-zhao 2021-11-25 11:21:52 +08:00 committed by fit2-zhao
parent 8074a97c13
commit 55eae14754
6 changed files with 34 additions and 18 deletions

View File

@ -99,8 +99,8 @@ export function saveScenario(url, scenario, scenarioDefinition, _this, success)
success(response);
}
}, error => {
_this.$emit('errorRefresh', {});
});
_this.$emit('errorRefresh', error);
},true);
}
export function editApiScenarioCaseOrder(request, callback) {

View File

@ -1501,7 +1501,10 @@ export default {
this.initMessageSocket();
}
},
errorRefresh() {
errorRefresh(error) {
if (error && (error + "").indexOf("code 400") !== -1) {
this.$warning("步骤内容解析失败,检查是否有已经移除的插件步骤。")
}
this.debug = false;
this.isTop = false;
this.debugLoading = false;

View File

@ -36,7 +36,6 @@ export default {
this.getExecResult();
} else {
this.response = this.result;
// this.isActive = true;
}
if(this.apiActive){
this.isActive = false
@ -62,10 +61,14 @@ export default {
let url = "/api/definition/report/getReport/" + this.apiItem.id;
this.$get(url, response => {
if (response.data) {
let data = JSON.parse(response.data.content);
this.response = data;
this.$set(this.apiItem, 'responseData', data);
this.isActive = true;
try {
let data = JSON.parse(response.data.content);
this.response = data;
this.$set(this.apiItem, 'responseData', data);
this.isActive = true;
}catch (error){
this.isActive = true;
}
}
});
}

View File

@ -502,9 +502,13 @@ export default {
let url = "/api/definition/report/get/" + apiCase.lastResultId;
this.$get(url, response => {
if (response.data) {
let data = JSON.parse(response.data.content);
this.response = data;
this.resVisible = true;
try {
let data = JSON.parse(response.data.content);
this.response = data;
this.resVisible = true;
} catch (error) {
this.resVisible = true;
}
}
});
}
@ -653,9 +657,9 @@ export default {
} else if (this.selectDataRange != null) {
let selectParamArr = this.selectDataRange.split(":");
if (selectParamArr.length === 2) {
if(selectParamArr[0] === "single") {
if (selectParamArr[0] === "single") {
this.condition.id = selectParamArr[1];
}else {
} else {
this.condition.apiDefinitionId = selectParamArr[1];
}
}

View File

@ -360,9 +360,13 @@ export default {
let url = "/api/definition/report/get/" + reportId;
this.$get(url, response => {
if (response.data) {
let data = JSON.parse(response.data.content);
this.response = data;
this.visible = true;
try {
let data = JSON.parse(response.data.content);
this.response = data;
this.visible = true;
} catch (error) {
this.visible = true;
}
}
});
}

View File

@ -107,7 +107,7 @@ export function post(url, data, success, failure) {
}
}
export function request(axiosRequestConfig, success, failure) {
export function request(axiosRequestConfig, success, failure, hideError) {
let result = {loading: true};
if (!success) {
return axios.request(axiosRequestConfig);
@ -115,7 +115,9 @@ export function request(axiosRequestConfig, success, failure) {
axios.request(axiosRequestConfig).then(response => {
then(success, response, result);
}).catch(error => {
exception(error, result);
if (!hideError) {
exception(error, result);
}
if (failure) {
then(failure, error, result);
}