(status: number, error: string)
| 126 | ) |
| 127 | |
| 128 | function jsonError(status: number, error: string): Response { |
| 129 | return new Response(JSON.stringify({ error }), { |
| 130 | status, |
| 131 | headers: { 'content-type': 'application/json' }, |
| 132 | }) |
| 133 | } |
| 134 | |
| 135 | /** |
| 136 | * Request middleware: parse + validate the body once and hand the typed result |