@push.rocks/webrequest
Version:
Modern, fetch-compatible web request library with intelligent HTTP caching, retry strategies, and fault tolerance.
58 lines (57 loc) • 1.64 kB
TypeScript
/**
* Interceptor manager for request/response transformation
*/
import type { TRequestInterceptor, TResponseInterceptor, TErrorInterceptor } from './interceptor.types.js';
export declare class InterceptorManager {
private requestInterceptors;
private responseInterceptors;
private errorInterceptors;
/**
* Add a request interceptor
*/
addRequestInterceptor(interceptor: TRequestInterceptor): void;
/**
* Add a response interceptor
*/
addResponseInterceptor(interceptor: TResponseInterceptor): void;
/**
* Add an error interceptor
*/
addErrorInterceptor(interceptor: TErrorInterceptor): void;
/**
* Remove a request interceptor
*/
removeRequestInterceptor(interceptor: TRequestInterceptor): void;
/**
* Remove a response interceptor
*/
removeResponseInterceptor(interceptor: TResponseInterceptor): void;
/**
* Remove an error interceptor
*/
removeErrorInterceptor(interceptor: TErrorInterceptor): void;
/**
* Clear all interceptors
*/
clearAll(): void;
/**
* Process request through all request interceptors
*/
processRequest(request: Request): Promise<Request>;
/**
* Process response through all response interceptors
*/
processResponse(response: Response): Promise<Response>;
/**
* Process error through all error interceptors
*/
processError(error: Error): Promise<Error>;
/**
* Get count of registered interceptors
*/
getInterceptorCounts(): {
request: number;
response: number;
error: number;
};
}