UNPKG

@push.rocks/webrequest

Version:

Modern, fetch-compatible web request library with intelligent HTTP caching, retry strategies, and fault tolerance.

32 lines (27 loc) 674 B
/** * Interceptor type definitions */ /** * Request interceptor * Transforms the request before it's sent */ export type TRequestInterceptor = ( request: Request, ) => Request | Promise<Request>; /** * Response interceptor * Transforms the response after it's received */ export type TResponseInterceptor = ( response: Response, ) => Response | Promise<Response>; /** * Error interceptor * Handles errors during request/response processing */ export type TErrorInterceptor = (error: Error) => Error | Promise<Error>; export interface IInterceptors { request?: TRequestInterceptor[]; response?: TResponseInterceptor[]; error?: TErrorInterceptor[]; }