From de19d9f400ac11b289f4f9da6f2248cfa1face4b Mon Sep 17 00:00:00 2001 From: lai <10633968+laiyujun1@user.noreply.gitee.com> Date: Thu, 26 Dec 2024 16:05:59 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BA=8C=E8=BF=9B=E5=88=B6=E5=86=85=E5=AE=B9?= =?UTF-8?q?=E7=9B=B4=E6=8E=A5=E8=BF=94=E5=9B=9E=E5=86=85=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/axios/src/index.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/packages/axios/src/index.ts b/packages/axios/src/index.ts index 64a75c3..7d4ac29 100644 --- a/packages/axios/src/index.ts +++ b/packages/axios/src/index.ts @@ -48,7 +48,7 @@ function createCommonRequest( instance.interceptors.response.use( async response => { - if (opts.isBackendSuccess(response)) { + if (opts.isBackendSuccess(response) || response.config?.responseType === "blob") { return Promise.resolve(response); } @@ -117,7 +117,6 @@ export function createRequest = await instance(config); const responseType = response.config?.responseType || 'json'; - if (responseType === 'json') { return opts.transformBackendResponse(response); } @@ -154,7 +153,6 @@ export function createFlatRequest = await instance(config); const responseType = response.config?.responseType || 'json'; - if (responseType === 'json') { const data = opts.transformBackendResponse(response);