import { BodyData, Layer, Method, Middleware } from './types'; declare type HttpOptions = Omit & { headers: Headers; }; declare type ErrorHandler = (err: unknown) => void; declare type Listener = (req: Request, res: Response) => void; export declare class Http { readonly baseUrl: string; readonly options: HttpOptions; protected errorHandlers: Set; protected listeners: Set; protected stack: Layer; constructor(baseUrl: string, options?: RequestInit, stack?: Layer); use(middleware: Middleware): void; subscribe(listener: Listener): () => void; onError(handler: ErrorHandler): () => void; setHeader(name: string, value: string): void; setBearer(token: string): void; protected createHeaders(init?: HeadersInit): Headers; protected request(method: Method, path: string, data: BodyData, options?: RequestInit): Promise; protected emit(req: Request, res: Response): void; protected handleError(err: unknown): void; protected run(req: Request): Promise; clone(pathname?: string): any; get(path: string, options?: RequestInit): Promise; post(path: string, data?: Req, options?: RequestInit): Promise; put(path: string, data?: Req, options?: RequestInit): Promise; patch(path: string, data?: Req, options?: RequestInit): Promise; delete(path: string, options?: RequestInit): Promise; search(path: string, query: object, options?: RequestInit): Promise; static create(url?: string, options?: RequestInit): Http; } export {};