fix(接口测试): 解决文件导入时缺少一些默认属性的问题
--user=郭雨琦 --bug=1014998 https://www.tapd.cn/55049933/bugtrace/bugs/view/1155049933001014998 --bug=1014819 https://www.tapd.cn/55049933/bugtrace/bugs/view/1155049933001014819
This commit is contained in:
parent
cefdbffb4b
commit
76f96b6d71
|
@ -62,6 +62,7 @@ import MsDrawer from "../../../../common/components/MsDrawer";
|
|||
import {CASE_ORDER} from "../../model/JsonData";
|
||||
import {API_CASE_CONFIGS} from "@/business/components/common/components/search/search-components";
|
||||
import {parseEnvironment} from "@/business/components/api/definition/model/EnvironmentModel";
|
||||
import {Body} from "@/business/components/api/definition/model/ApiTestModel";
|
||||
|
||||
export default {
|
||||
name: 'ApiCaseList',
|
||||
|
@ -418,6 +419,28 @@ export default {
|
|||
}
|
||||
if (Object.prototype.toString.call(apiCase.request).match(/\[object (\w+)\]/)[1].toLowerCase() !== 'object') {
|
||||
apiCase.request = JSON.parse(apiCase.request);
|
||||
if (!apiCase.request.body) {
|
||||
apiCase.request.body = new Body();
|
||||
}
|
||||
if (!apiCase.request.headers) {
|
||||
apiCase.request.headers = [];
|
||||
}
|
||||
if (!apiCase.request.rest) {
|
||||
apiCase.request.rest = [];
|
||||
}
|
||||
if (!apiCase.request.arguments) {
|
||||
apiCase.request.arguments = [
|
||||
{
|
||||
contentType: "text/plain",
|
||||
enable: true,
|
||||
file: false,
|
||||
required: false,
|
||||
type: "text",
|
||||
urlEncode: false,
|
||||
valid: false
|
||||
}
|
||||
];
|
||||
}
|
||||
}
|
||||
if (!apiCase.request.hashTree) {
|
||||
apiCase.request.hashTree = [];
|
||||
|
|
|
@ -676,6 +676,50 @@ export default {
|
|||
item.tags = JSON.parse(item.tags);
|
||||
}
|
||||
item.caseTotal = parseInt(item.caseTotal);
|
||||
if (!item.response) {
|
||||
let response = {headers: [], body: new Body(), statusCode: [], type: "HTTP"};
|
||||
item.response = JSON.stringify(response);
|
||||
}
|
||||
if (item.response) {
|
||||
item.response = JSON.parse(item.response);
|
||||
if (!item.response.body) {
|
||||
item.response.body = new Body();
|
||||
}
|
||||
if (!item.response.headers) {
|
||||
item.response.headers = [];
|
||||
}
|
||||
if (!item.response.statusCode) {
|
||||
item.response.statusCode = [];
|
||||
}
|
||||
item.response = JSON.stringify(item.response);
|
||||
}
|
||||
//request
|
||||
if (item.request) {
|
||||
item.request = JSON.parse(item.request);
|
||||
if (!item.request.body) {
|
||||
item.request.body = new Body();
|
||||
}
|
||||
if (!item.request.headers) {
|
||||
item.request.headers = [];
|
||||
}
|
||||
if (!item.request.rest) {
|
||||
item.request.rest = [];
|
||||
}
|
||||
if (!item.request.arguments) {
|
||||
item.request.arguments = [
|
||||
{
|
||||
contentType: "text/plain",
|
||||
enable: true,
|
||||
file: false,
|
||||
required: false,
|
||||
type: "text",
|
||||
urlEncode: false,
|
||||
valid: false
|
||||
}
|
||||
];
|
||||
}
|
||||
item.request = JSON.stringify(item.request);
|
||||
}
|
||||
});
|
||||
this.$emit('getTrashApi');
|
||||
if (this.$refs.table) {
|
||||
|
|
Loading…
Reference in New Issue