fix(接口测试): 修复场景选择运行环境,环境列表为空的缺陷

--bug=1032426 --user=王孝刚 【接口自动化】全新空间和项目-接口场景-选择运行环境时,列表是空
https://www.tapd.cn/55049933/s/1430979
This commit is contained in:
wxg0103 2023-10-26 18:49:54 +08:00 committed by 刘瑞斌
parent d029f2a5fd
commit 3035fab409
3 changed files with 25 additions and 29 deletions

View File

@ -126,19 +126,15 @@ export default {
this.srcUrl = 'data:' + this.response.contentType + ';base64,' + this.response.imageUrl;
}
if (this.response && this.response.contentType) {
switch (this.response.contentType) {
case 'application/json':
this.mode = BODY_FORMAT.JSON;
break;
case 'text/html':
this.mode = BODY_FORMAT.HTML;
break;
case 'text/xml':
this.mode = BODY_FORMAT.XML;
break;
default:
this.mode = BODY_FORMAT.TEXT;
break;
let contentType = this.response.contentType;
if (contentType.includes('application/json')) {
this.mode = BODY_FORMAT.JSON;
} else if (contentType.includes('text/html')) {
this.mode = BODY_FORMAT.HTML;
} else if (contentType.includes('text/xml')) {
this.mode = BODY_FORMAT.XML;
} else {
this.mode = BODY_FORMAT.TEXT;
}
}
},

View File

@ -1970,10 +1970,14 @@ export default {
}
this.projectIds.add(this.projectId);
if (this.projectIds.size > 1) {
getApiScenarioEnv(Array.from(this.projectIds)).then((res) => {
this.projectIds = new Set(res.data.projectIds);
resolve();
let projects = [];
this.projectIds.forEach((item) => {
if (this.projectList.filter(project => project.id === item).length > 0) {
projects.push(item);
}
});
this.projectIds = projects;
resolve();
} else {
resolve();
}

View File

@ -171,19 +171,15 @@ export default {
});
}
if (this.response && this.response.responseResult && this.response.responseResult.contentType) {
switch (this.response.responseResult.contentType) {
case 'application/json':
this.mode = BODY_FORMAT.JSON;
break;
case 'text/html':
this.mode = BODY_FORMAT.HTML;
break;
case 'text/xml':
this.mode = BODY_FORMAT.XML;
break;
default:
this.mode = BODY_FORMAT.TEXT;
break;
let contentType = this.response.responseResult.contentType;
if (contentType.includes('application/json')) {
this.mode = BODY_FORMAT.JSON;
} else if (contentType.includes('text/html')) {
this.mode = BODY_FORMAT.HTML;
} else if (contentType.includes('text/xml')) {
this.mode = BODY_FORMAT.XML;
} else {
this.mode = BODY_FORMAT.TEXT;
}
}
this.msCodeReload();