mirror of
https://gitlab.com/mbugroup/lti-web-client.git
synced 2026-05-25 07:45:47 +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'
|
auth?: AuthMode; // 'cookie' | 'bearer' | 'none'
|
||||||
token?: string; // required if auth === 'bearer'
|
token?: string; // required if auth === 'bearer'
|
||||||
timeoutMs?: number;
|
timeoutMs?: number;
|
||||||
|
responseType?:
|
||||||
|
| 'arraybuffer'
|
||||||
|
| 'blob'
|
||||||
|
| 'document'
|
||||||
|
| 'json'
|
||||||
|
| 'text'
|
||||||
|
| 'stream';
|
||||||
};
|
};
|
||||||
|
|
||||||
export class HttpError extends Error {
|
export class HttpError extends Error {
|
||||||
|
|||||||
@@ -40,6 +40,7 @@ export async function httpClient<T, B = unknown>(
|
|||||||
data: opts.body,
|
data: opts.body,
|
||||||
timeout: opts.timeoutMs ?? 10_000,
|
timeout: opts.timeoutMs ?? 10_000,
|
||||||
withCredentials: isCookieAuth && !isBearerAuth,
|
withCredentials: isCookieAuth && !isBearerAuth,
|
||||||
|
responseType: opts.responseType,
|
||||||
headers: {
|
headers: {
|
||||||
...(isFormData ? {} : { 'Content-Type': 'application/json' }),
|
...(isFormData ? {} : { 'Content-Type': 'application/json' }),
|
||||||
...(opts.headers ?? {}),
|
...(opts.headers ?? {}),
|
||||||
|
|||||||
Reference in New Issue
Block a user