diff --git a/types/express-http-proxy/express-http-proxy-tests.ts b/types/express-http-proxy/express-http-proxy-tests.ts index 56156369cc..c96ec0fc8d 100644 --- a/types/express-http-proxy/express-http-proxy-tests.ts +++ b/types/express-http-proxy/express-http-proxy-tests.ts @@ -26,3 +26,5 @@ proxy('www.google.com', { return headers; } }); + +proxy((req) => 'com.google.www'.split('.').reverse().join('.')); diff --git a/types/express-http-proxy/index.d.ts b/types/express-http-proxy/index.d.ts index 3a74bef6db..d1935f3bc3 100644 --- a/types/express-http-proxy/index.d.ts +++ b/types/express-http-proxy/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/villadora/express-http-proxy#readme // Definitions by: ulrichb // Daniel Schopf +// Gabriel Fournier // 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;