UNPKG

687 BTypeScriptView Raw
1/// <reference types="node" />
2import type * as http from 'http';
3declare type Interceptor = (buffer: Buffer, proxyRes: http.IncomingMessage, req: http.IncomingMessage, res: http.ServerResponse) => Promise<Buffer | string>;
4/**
5 * Intercept responses from upstream.
6 * Automatically decompress (deflate, gzip, brotli).
7 * Give developer the opportunity to modify intercepted Buffer and http.ServerResponse
8 *
9 * NOTE: must set options.selfHandleResponse=true (prevent automatic call of res.end())
10 */
11export declare function responseInterceptor(interceptor: Interceptor): (proxyRes: http.IncomingMessage, req: http.IncomingMessage, res: http.ServerResponse) => Promise<void>;
12export {};