Skip to content

Commit

Permalink
fix: add handling of empty batches
Browse files Browse the repository at this point in the history
  • Loading branch information
BelfordZ authored and mhanson-github committed Nov 13, 2024
1 parent 389a87a commit 4a121a3
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/middlewares/methodWhitelist.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ export const methodWhitelist = (req: Request, res: Response, next: NextFunction)
const body = req.body

if (Array.isArray(body)) {
if (body.length === 0) {
return res.status(400).json({ error: 'Empty batch request' })
}

// Handle batch requests
const allMethodsAllowed = body.every(request => {
const method = request?.method
Expand Down

0 comments on commit 4a121a3

Please sign in to comment.