@beenotung/tslib
Version:
utils library in Typescript
18 lines (17 loc) • 811 B
TypeScript
/**
* check if the status code is 2xx
* */
export declare function checkedFetch<T>({ input, init, on2xx, non2xx, }: {
input: RequestInfo | URL;
init?: RequestInit;
on2xx: (response: Response) => T | Promise<T>;
non2xx: (response: Response) => T | Promise<T>;
}): Promise<T>;
export declare function parseRetryAfter(retryAfter: string | null): number | null;
export type FetchWithRetryOptions = {
maxRetryCount?: number;
defaultRetryAfterInterval?: number;
};
export declare const fetch_retry_status_codes: number[];
export declare function fetch_with_retry(input: RequestInfo | URL, init?: RequestInit, options?: FetchWithRetryOptions): Promise<Response>;
export declare function fetch_json(input: RequestInfo | URL, init?: RequestInit, options?: FetchWithRetryOptions): Promise<any>;