fix(测试用例): 导出-修复下载文件缺陷

This commit is contained in:
teukkk 2024-08-12 15:16:05 +08:00 committed by 刘瑞斌
parent 6a67b6d859
commit b26d7de88d
2 changed files with 5 additions and 2 deletions

View File

@ -466,7 +466,10 @@ export function checkCaseExportTask() {
}
// 获取导出的文件
export function getCaseDownloadFile(projectId: string, fileId: string) {
return MSR.get({ url: `${GetCaseDownloadFileUrl}/${projectId}/${fileId}` });
return MSR.get(
{ url: `${GetCaseDownloadFileUrl}/${projectId}/${fileId}`, responseType: 'blob' },
{ isTransformResponse: false, isReturnNativeResponse: true }
);
}
// 停止导出
export function stopCaseExport(taskId: string) {

View File

@ -1095,7 +1095,7 @@
try {
const response = await getCaseDownloadFile(currentProjectId.value, reportId.value);
const fileName = response?.headers.get('content-disposition').split('filename=')[1];
downloadByteFile(response.blob(), fileName);
downloadByteFile(response.data, fileName);
} catch (error) {
// eslint-disable-next-line no-console
console.log(error);