feat: add responseType to axios config

This commit is contained in:
ValdiANS
2026-04-09 14:15:29 +07:00
parent e50f4dbddb
commit 62d250109b
2 changed files with 8 additions and 0 deletions
+7
View File
@@ -9,6 +9,13 @@ export type RequestOptions<B = unknown> = {
auth?: AuthMode; // 'cookie' | 'bearer' | 'none'
token?: string; // required if auth === 'bearer'
timeoutMs?: number;
responseType?:
| 'arraybuffer'
| 'blob'
| 'document'
| 'json'
| 'text'
| 'stream';
};
export class HttpError extends Error {
+1
View File
@@ -40,6 +40,7 @@ export async function httpClient<T, B = unknown>(
data: opts.body,
timeout: opts.timeoutMs ?? 10_000,
withCredentials: isCookieAuth && !isBearerAuth,
responseType: opts.responseType,
headers: {
...(isFormData ? {} : { 'Content-Type': 'application/json' }),
...(opts.headers ?? {}),