UNPKG

882 BTypeScriptView Raw
1import type { RequestHandler, Options } from './types';
2export declare class HttpProxyMiddleware<TReq, TRes> {
3 private wsInternalSubscribed;
4 private serverOnCloseSubscribed;
5 private proxyOptions;
6 private proxy;
7 private pathRewriter;
8 constructor(options: Options<TReq, TRes>);
9 middleware: RequestHandler;
10 private registerPlugins;
11 private catchUpgradeRequest;
12 private handleUpgrade;
13 /**
14 * Determine whether request should be proxied.
15 */
16 private shouldProxy;
17 /**
18 * Apply option.router and option.pathRewrite
19 * Order matters:
20 * Router uses original path for routing;
21 * NOT the modified path, after it has been rewritten by pathRewrite
22 * @param {Object} req
23 * @return {Object} proxy options
24 */
25 private prepareProxyRequest;
26 private applyRouter;
27 private applyPathRewrite;
28}