* Helper to get parameter value from request (checks body first, then query)
(req: Request, paramName: string)
| 11 | * Helper to get parameter value from request (checks body first, then query) |
| 12 | */ |
| 13 | function getParamValue(req: Request, paramName: string): unknown { |
| 14 | // Check body first (for POST/PUT/PATCH requests) |
| 15 | if (req.body && req.body[paramName] !== undefined) { |
| 16 | return req.body[paramName]; |
| 17 | } |
| 18 | // Fall back to query params (for GET requests) |
| 19 | if (req.query && req.query[paramName] !== undefined) { |
| 20 | return req.query[paramName]; |
| 21 | } |
| 22 | return undefined; |
| 23 | } |
| 24 | |
| 25 | /** |
| 26 | * Creates a middleware that validates specified path parameters in req.body or req.query |
no outgoing calls
no test coverage detected