response-interceptor.d.ts 687 B

123456789101112
  1. /// <reference types="node" />
  2. import type * as http from 'http';
  3. declare 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. */
  11. export declare function responseInterceptor(interceptor: Interceptor): (proxyRes: http.IncomingMessage, req: http.IncomingMessage, res: http.ServerResponse) => Promise<void>;
  12. export {};