2
0

二进制内容直接返回内容

This commit is contained in:
lai
2024-12-26 16:05:59 +08:00
parent 8ac4d3f9df
commit de19d9f400

View File

@@ -48,7 +48,7 @@ function createCommonRequest<ResponseData = any>(
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<ResponseData = any, State = Record<string, unknown
const response: AxiosResponse<ResponseData> = await instance(config);
const responseType = response.config?.responseType || 'json';
if (responseType === 'json') {
return opts.transformBackendResponse(response);
}
@@ -154,7 +153,6 @@ export function createFlatRequest<ResponseData = any, State = Record<string, unk
const response: AxiosResponse<ResponseData> = await instance(config);
const responseType = response.config?.responseType || 'json';
if (responseType === 'json') {
const data = opts.transformBackendResponse(response);