express-http-proxy: Add limit parameter for proxy options (#35014)

* Add limit parameter for proxy options

* Remove null from type for limit
This commit is contained in:
Erik Beuschau
2019-04-29 16:49:43 -07:00
committed by Wesley Wigham
parent b1d706c8f5
commit 880a95c647
2 changed files with 14 additions and 0 deletions
@@ -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);
+6
View File
@@ -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;