feat(接口测试): 接口&用例复制文件错误捕获

This commit is contained in:
baiqi 2024-12-13 15:50:34 +08:00 committed by Craftsman
parent 598bcadf94
commit da688552cf
2 changed files with 28 additions and 13 deletions

View File

@ -381,11 +381,16 @@
let copyFilesMap: Record<string, any> = {};
const fileIds = parseRequestBodyFiles(res.request.body, [], [], []).uploadFileIds;
if (fileIds.length > 0 && isCopy) {
copyFilesMap = await definitionFileCopy({
resourceId: typeof apiInfo === 'string' ? apiInfo : apiInfo.id,
fileIds,
});
parseRequestBodyFiles(res.request.body, res.response, [], [], copyFilesMap); // id
try {
copyFilesMap = await definitionFileCopy({
resourceId: typeof apiInfo === 'string' ? apiInfo : apiInfo.id,
fileIds,
});
parseRequestBodyFiles(res.request.body, res.response, [], [], copyFilesMap); // id
} catch (error) {
// eslint-disable-next-line no-console
console.log(error);
}
} else {
parseRequestBodyResult = parseRequestBodyFiles(res.request.body, res.response, [], [], copyFilesMap); // id
}

View File

@ -227,10 +227,15 @@
let copyFilesMap: Record<string, any> = {};
const fileIds = parseRequestBodyFiles(apiDetailInfo.value.request.body, [], [], []).uploadFileIds;
if (fileIds.length > 0) {
copyFilesMap = await definitionFileCopy({
resourceId: apiDetailInfo.value.id as string,
fileIds,
});
try {
copyFilesMap = await definitionFileCopy({
resourceId: apiDetailInfo.value.id as string,
fileIds,
});
} catch (error) {
// eslint-disable-next-line no-console
console.log(error);
}
}
parseRequestBodyFiles(apiDetailInfo.value.request.body, [], [], [], copyFilesMap); // id
}
@ -258,10 +263,15 @@
let copyFilesMap: Record<string, any> = {};
const fileIds = parseRequestBodyFiles(record.request.body, [], [], []).uploadFileIds;
if (fileIds.length > 0) {
copyFilesMap = await caseFileCopy({
resourceId: record.id as string,
fileIds,
});
try {
copyFilesMap = await caseFileCopy({
resourceId: record.id as string,
fileIds,
});
} catch (error) {
// eslint-disable-next-line no-console
console.log(error);
}
}
parseRequestBodyFiles(record.request.body, [], [], [], copyFilesMap); // id
detailForm.value = {