-
Notifications
You must be signed in to change notification settings - Fork 45
/
Copy pathindex.d.ts
26 lines (21 loc) · 1.01 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import { IncomingMessage, ServerResponse, ClientRequest } from 'http';
import * as Koa from 'koa';
declare function KoaProxies(path: string | RegExp | (string | RegExp)[], options: KoaProxies.IKoaProxiesOptions): Koa.Middleware;
declare namespace KoaProxies {
interface IBaseKoaProxiesOptions {
target: string;
changeOrigin?: boolean;
logs?: boolean | ((ctx: Koa.Context, target: string) => void);
agent?: any;
headers?: {[key: string]: string};
rewrite?: (path: string) => string;
events?: {
error?: (error: any, req: IncomingMessage, res: ServerResponse) => void;
proxyReq?: (proxyReq: ClientRequest, req: IncomingMessage, res: ServerResponse) => void;
proxyRes?: (proxyRes: IncomingMessage, req: IncomingMessage, res: ServerResponse) => void;
}
}
type IKoaProxiesOptionsFunc = (params: { [key: string]: string }, ctx: Koa.Context) => IBaseKoaProxiesOptions | false;
type IKoaProxiesOptions = string | IBaseKoaProxiesOptions | IKoaProxiesOptionsFunc;
}
export = KoaProxies;