@straw-hat/fetcher
Version:
Simple HTTP Client
11 lines (10 loc) • 457 B
TypeScript
import { Middleware } from './middleware.js';
import { HttpRequest } from './request.js';
export type Fetch = typeof fetch;
export type Path = string;
export interface ClientConfiguration {
middleware?: Middleware<any>;
fetch?: Fetch;
}
export type Fetcher<T = Response, P = HttpRequest> = (path: string, options?: Partial<P>) => Promise<T>;
export declare function fetcher<T = Response, P = HttpRequest>(opts?: ClientConfiguration): Fetcher<T, P>;