UNPKG

@trlogic/tracker-web

Version:
23 lines (22 loc) 829 B
/** * HTTP utility functions using fetch API */ export interface HttpRequestConfig { headers?: Record<string, string>; timeout?: number; method?: "GET" | "POST" | "PUT" | "DELETE"; } export declare class HttpError extends Error { status: number; response?: Response | undefined; constructor(message: string, status: number, response?: Response | undefined); } export declare class HttpClient { private defaultHeaders; constructor(defaultHeaders?: Record<string, string>); private makeRequest; get<T>(url: string, config?: HttpRequestConfig): Promise<T>; post<T>(url: string, data?: unknown, config?: HttpRequestConfig): Promise<T>; put<T>(url: string, data?: unknown, config?: HttpRequestConfig): Promise<T>; delete<T>(url: string, config?: HttpRequestConfig): Promise<T>; }