Interface IHttpOpts

interface IHttpOpts {
    accessToken?: string;
    baseUrl: string;
    extraParams?: Record<string, string>;
    fetchFn?: {
        (input: RequestInfo | URL, init?: RequestInit): Promise<Response>;
        (input: string | Request | URL, init?: RequestInit): Promise<Response>;
    };
    idBaseUrl?: string;
    localTimeoutMs?: number;
    logger?: Logger;
    onlyData?: boolean;
    prefix: string;
    refreshToken?: string;
    tokenRefreshFunction?: TokenRefreshFunction;
    useAuthorizationHeader?: boolean;
}

Properties

accessToken?: string
baseUrl: string
extraParams?: Record<string, string>
fetchFn?: {
    (input: RequestInfo | URL, init?: RequestInit): Promise<Response>;
    (input: string | Request | URL, init?: RequestInit): Promise<Response>;
}

Type declaration

idBaseUrl?: string
localTimeoutMs?: number
logger?: Logger

Optional logger instance. If provided, requests and responses will be logged.

onlyData?: boolean
prefix: string
refreshToken?: string

Used in conjunction with tokenRefreshFunction to attempt token refresh

tokenRefreshFunction?: TokenRefreshFunction

Function to attempt token refresh when a possibly expired token is encountered Optional, only called when a refreshToken is present

useAuthorizationHeader?: boolean