From 17673008d43faee677ec2a3320cf918abcc10ca4 Mon Sep 17 00:00:00 2001 From: Erwin Wessels <54856303+erwinpleo@users.noreply.github.com> Date: Wed, 1 Apr 2020 18:44:40 +0200 Subject: [PATCH] express-http-proxy: proxyReqPathResolver can also return Promise (#43528) * Add test, too * proxyReqPathResolver: can also return promise proxyReqPathResolver can also return a promise to a string * Update version number Update version number of express-http-proxy to 1.6 --- types/express-http-proxy/express-http-proxy-tests.ts | 4 ++++ types/express-http-proxy/index.d.ts | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/types/express-http-proxy/express-http-proxy-tests.ts b/types/express-http-proxy/express-http-proxy-tests.ts index 61eb11a056..0f2f69d025 100644 --- a/types/express-http-proxy/express-http-proxy-tests.ts +++ b/types/express-http-proxy/express-http-proxy-tests.ts @@ -11,6 +11,10 @@ proxy("www.google.com", { proxyReqPathResolver: req => req.url }); +proxy("www.google.com", { + proxyReqPathResolver: async req => req.url +}); + proxy("www.google.com", { limit: "10mb" }); diff --git a/types/express-http-proxy/index.d.ts b/types/express-http-proxy/index.d.ts index 651619197b..201f1334dd 100644 --- a/types/express-http-proxy/index.d.ts +++ b/types/express-http-proxy/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for express-http-proxy 1.5 +// Type definitions for express-http-proxy 1.6 // Project: https://github.com/villadora/express-http-proxy#readme // Definitions by: ulrichb // Daniel Schopf @@ -25,7 +25,7 @@ declare namespace proxy { res: Response, next: NextFunction ) => any; - proxyReqPathResolver?: (req: Request) => string; + proxyReqPathResolver?: (req: Request) => string | Promise; proxyReqOptDecorator?: ( proxyReqOpts: RequestOptions, srcReq: Request