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; this.srcUrl = 'data:' + this.response.contentType + ';base64,' + this.response.imageUrl;
} }
if (this.response && this.response.contentType) { if (this.response && this.response.contentType) {
switch (this.response.contentType) { let contentType = this.response.contentType;
case 'application/json': if (contentType.includes('application/json')) {
this.mode = BODY_FORMAT.JSON; this.mode = BODY_FORMAT.JSON;
break; } else if (contentType.includes('text/html')) {
case 'text/html': this.mode = BODY_FORMAT.HTML;
this.mode = BODY_FORMAT.HTML; } else if (contentType.includes('text/xml')) {
break; this.mode = BODY_FORMAT.XML;
case 'text/xml': } else {
this.mode = BODY_FORMAT.XML; this.mode = BODY_FORMAT.TEXT;
break;
default:
this.mode = BODY_FORMAT.TEXT;
break;
} }
} }
}, },

View File

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

View File

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