UNPKG

@fiizy/fitch

Version:
30 lines (29 loc) 931 B
export interface HttpOptions { baseURL?: string; transformRequest?: { (request: JsonObject): JsonObject; }[]; transformResponse?: { <T>(response: HttpResponse<T>): HttpResponse<T>; }[]; headers?: HeadersInit; } export interface HttpResponse<T> extends Response { parsedBody?: T; } export interface JsonObject { [k: string]: any; } export declare class Fitch { private readonly baseURL; private readonly transformRequest; private readonly transformResponse; private readonly headers; constructor(options?: HttpOptions); private http; get<T>(path: string, args?: JsonObject): Promise<T>; delete<T>(path: string, args?: JsonObject): Promise<T>; post<T>(path: string, body: any, args?: JsonObject): Promise<T>; put<T>(path: string, body: any, args?: JsonObject): Promise<T>; patch<T>(path: string, body: any, args?: JsonObject): Promise<T>; }