( req: Request, maxSize: number = 10485760, )
| 383 | }; |
| 384 | |
| 385 | export const readBody = async ( |
| 386 | req: Request, |
| 387 | maxSize: number = 10485760, |
| 388 | ): Promise<ReturnType<typeof safeParse>> => { |
| 389 | if ( |
| 390 | typeof req.body === 'string' && |
| 391 | (isBase64Encoded(req.body) || req.body.startsWith('{')) |
| 392 | ) { |
| 393 | return safeParse(convertIfBase64(req.body)); |
| 394 | } |
| 395 | const body = await readRequestBody(req, maxSize); |
| 396 | |
| 397 | return req.headers['content-type']?.includes(contentTypes.json) |
| 398 | ? safeParse(body) |
| 399 | : body; |
| 400 | }; |
| 401 | |
| 402 | /** |
| 403 | * Lists the path of Chromes (stable) install since |
no test coverage detected