mirror of
https://gitlab.com/mbugroup/lti-web-client.git
synced 2026-05-20 13:32:00 +00:00
feat: add responseType to axios config
This commit is contained in:
@@ -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 {
|
||||
|
||||
@@ -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 ?? {}),
|
||||
|
||||
Reference in New Issue
Block a user