diff --git a/types/express-http-proxy/express-http-proxy-tests.ts b/types/express-http-proxy/express-http-proxy-tests.ts index c96ec0fc8d..6c628b3c49 100644 --- a/types/express-http-proxy/express-http-proxy-tests.ts +++ b/types/express-http-proxy/express-http-proxy-tests.ts @@ -11,6 +11,14 @@ proxy('www.google.com', { proxyReqPathResolver: (req) => req.url, }); +proxy('www.google.com', { + limit: "10mb" +}); + +proxy('www.google.com', { + limit: 1024 +}); + proxy('www.google.com', { proxyReqOptDecorator(proxyReqOpts, srcReq) { console.log(proxyReqOpts.headers, proxyReqOpts.method); diff --git a/types/express-http-proxy/index.d.ts b/types/express-http-proxy/index.d.ts index d1935f3bc3..6d1943fa9c 100644 --- a/types/express-http-proxy/index.d.ts +++ b/types/express-http-proxy/index.d.ts @@ -11,6 +11,12 @@ import { RequestOptions, IncomingHttpHeaders, OutgoingHttpHeaders } from "http"; import { Response } from "express-serve-static-core"; interface ProxyOptions { + /** + * The byte limit of the body. This is the number of bytes or any string + * format supported by `bytes`, for example `1000`, `'500kb'` or `'3mb'`. + * See https://github.com/stream-utils/raw-body/blob/master/index.d.ts + */ + limit?: number | string; proxyReqPathResolver?: (req: Request) => string; proxyReqOptDecorator?: (proxyReqOpts: RequestOptions, srcReq: Request) => RequestOptions; userResHeaderDecorator?: (headers: IncomingHttpHeaders, userReq: Request, userRes: Response, proxyReq: Request, proxyRes: Response) => OutgoingHttpHeaders;