From 98ab93763399e49c7b65483ea2a84ba733a01f59 Mon Sep 17 00:00:00 2001 From: Zachary Belford Date: Wed, 13 Nov 2024 13:00:10 -0800 Subject: [PATCH] fix: error when batch size is above 100 --- src/middlewares/methodWhitelist.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/middlewares/methodWhitelist.ts b/src/middlewares/methodWhitelist.ts index fb543b86..485d3e44 100644 --- a/src/middlewares/methodWhitelist.ts +++ b/src/middlewares/methodWhitelist.ts @@ -10,6 +10,10 @@ export const methodWhitelist = (req: Request, res: Response, next: NextFunction) if (body.length === 0) { return res.status(400).json({ error: 'Empty batch request' }) } + + if (body.length > 100) { // remove in favor of jayson option when updated to jayson@4.x.x + return res.status(400).json({ error: 'Max batch size exceeded (100)' }) + } // Handle batch requests const allMethodsAllowed = body.every(request => { @@ -29,4 +33,4 @@ export const methodWhitelist = (req: Request, res: Response, next: NextFunction) } return res.status(403).json({ error: 'Forbidden' }) -} \ No newline at end of file +}