UNPKG

node-request-interceptor

Version:

Low-level HTTP/HTTPS/XHR request interception library for NodeJS

18 lines (17 loc) 624 B
import { Interceptor, RequestInterceptorEventsMap, RequestMiddleware } from './glossary'; export declare class RequestInterceptor { private interceptors; private emitter; private middleware; constructor(interceptors: Interceptor[]); /** * Applies given request middleware to any intercepted request. */ use(requestMiddleware: RequestMiddleware): void; on<K extends keyof RequestInterceptorEventsMap>(eventType: K, listener: RequestInterceptorEventsMap[K]): void; private applyMiddleware; /** * Restores original instances of patched modules. */ restore(): void; }