declare const ON_GLOBAL_DOWNLOAD_PROGRESS: unique symbol; declare const ABORT_CONTROLLER: unique symbol; declare class Req extends Request { readonly meta: Record; readonly timeout: number; readonly responseType?: ResponseType; readonly throwHttpError: boolean; readonly [ABORT_CONTROLLER]: AbortController; readonly onDownloadProgress?: ProgressCallback; readonly [ON_GLOBAL_DOWNLOAD_PROGRESS]?: ProgressCallback; constructor(request: Req, init: ReqInit | Request); clone(): Req; } declare class Res extends Response { readonly meta: Record; readonly timeout: number; readonly responseType?: ResponseType; readonly throwHttpError: boolean; readonly abortController: AbortController; readonly onDownloadProgress?: ProgressCallback; readonly [ON_GLOBAL_DOWNLOAD_PROGRESS]?: ProgressCallback; constructor(response: Res, init: ResInit | Response); clone(): Res; } interface ResInit extends ResponseInit { meta?: Record; body?: BodyInit | Record | null; timeout?: number; responseType?: ResponseType; throwHttpError?: boolean; [ABORT_CONTROLLER]?: AbortController; onDownloadProgress?: ProgressCallback; [ON_GLOBAL_DOWNLOAD_PROGRESS]?: ProgressCallback; } interface ReqInit extends Omit { url?: string; method?: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'HEAD' | 'PATCH'; meta?: Record; timeout?: number; /** * This should be consistent with the parsing method of Response */ responseType?: ResponseType; throwHttpError?: boolean; body?: BodyInit | Record; onDownloadProgress?: ProgressCallback; [ON_GLOBAL_DOWNLOAD_PROGRESS]?: ProgressCallback; } type Next = (req: Req) => Promise; type Middleware = (next: Next) => (req: Req) => Promise; type ResponseType = 'json' | 'arrayBuffer' | 'blob' | 'formData' | 'text' | null | false; interface Progress { ratio: number; carry: number; total: number; } type ProgressCallback = (progress: Progress, chunk: Uint8Array) => void; interface Options extends ReqInit { baseURL?: string; params?: Record; } /** * Merge Headers * @param target target.headers * @param source source.headers * @returns headers */ declare const mergeHeaders: (target: HeadersInit | Headers, source: HeadersInit | Headers) => Headers; declare class Resreq { options: Options; middlewares: Middleware[]; constructor(options?: Options); use(middleware: Middleware | Middleware[]): this; request(options: Options): Promise; get(url: string, options?: Options): Promise; post(url: string, options?: Options): Promise; put(url: string, options?: Options): Promise; delete(url: string, options?: Options): Promise; patch(url: string, options?: Options): Promise; head(url: string, options?: Options): Promise; } export { type Middleware, type Next, type Options, type Progress, type ProgressCallback, Req, type ReqInit, Res, type ResInit, type ResponseType, Resreq as default, mergeHeaders };