[@types/express-http-proxy] Add proxyReqBodyDecorator property to ProxyOptions (#36485)

* feat: add proxyReqBodyDecorator to ProxyOptions

* style: group all callback functions
This commit is contained in:
Ajay 2019-07-01 23:38:27 +05:30 committed by Ryan Cavanaugh
parent 9c3af8d04e
commit 43b735cdf0
2 changed files with 17 additions and 2 deletions

View File

@ -128,3 +128,17 @@ proxy("httpbin.org", {
proxy("httpbin.org", {
timeout: 2000
});
proxy("www.google.com", {
proxyReqBodyDecorator(bodyContent, srcReq) {
return bodyContent;
}
});
proxy("www.google.com", {
proxyReqBodyDecorator(bodyContent, srcReq) {
return new Promise((resolve, reject) => {
resolve(bodyContent);
});
},
});

View File

@ -43,11 +43,12 @@ declare namespace proxy {
userReq: Request,
userRes: Response
) => Buffer | string | Promise<Buffer | string>;
filter?: (req: Request, res: Response) => boolean;
skipToNextHandlerFilter?: (proxyRes: Response) => boolean;
proxyReqBodyDecorator?: (bodyContent: any, srcReq: Request) => any;
preserveHostHdr?: boolean;
parseReqBody?: boolean;
filter?: (req: Request, res: Response) => boolean;
memoizeHost?: boolean;
skipToNextHandlerFilter?: (proxyRes: Response) => boolean;
https?: boolean;
reqAsBuffer?: boolean;
reqBodyEncoding?: string | null;