二进制内容直接返回内容
This commit is contained in:
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user