Improve Proxy Command Typings

This commit is contained in:
Gabriel 2019-03-29 10:32:57 -04:00
parent d430889d20
commit cb52fa93b0
2 changed files with 4 additions and 1 deletions

View File

@ -26,3 +26,5 @@ proxy('www.google.com', {
return headers;
}
});
proxy((req) => 'com.google.www'.split('.').reverse().join('.'));

View File

@ -2,6 +2,7 @@
// Project: https://github.com/villadora/express-http-proxy#readme
// Definitions by: ulrichb <https://github.com/ulrichb>
// Daniel Schopf <https://github.com/Danscho>
// Gabriel Fournier <https://github.com/carboneater>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
@ -15,6 +16,6 @@ interface ProxyOptions {
userResHeaderDecorator?: (headers: IncomingHttpHeaders, userReq: Request, userRes: Response, proxyReq: Request, proxyRes: Response) => OutgoingHttpHeaders;
}
declare function proxy(host: string, options?: ProxyOptions): RequestHandler;
declare function proxy(host: string|((req: Request) => string), options?: ProxyOptions): RequestHandler;
export = proxy;