UNPKG

zeph-http

Version:

A modern, performant, and type-safe HTTP client for TypeScript/JavaScript. Axios-like API with advanced features, ESM/CJS support, and tree-shakable design.

32 lines (31 loc) 1.04 kB
import { ErrorInterceptor, RequestInterceptor, ResponseInterceptor } from "./types"; /** * Collection of request and response interceptors for a Zeph client instance. */ export interface Interceptors { request: { handlers: RequestInterceptor[]; /** * Register a new request interceptor. * @param fn The interceptor function. */ use: (fn: RequestInterceptor) => void; }; response: { handlers: Array<{ onSuccess: ResponseInterceptor; onError?: ErrorInterceptor; }>; /** * Register a new response interceptor. * @param onSuccess The success handler. * @param onError Optional error handler. */ use: (onSuccess: ResponseInterceptor, onError?: ErrorInterceptor) => void; }; } /** * Creates a new interceptor manager for a Zeph client instance. * @returns An Interceptors object for managing request/response hooks. */ export declare function createInterceptorManager(): Interceptors;