(env)
| 383 | } |
| 384 | |
| 385 | function assertConfigured(env) { |
| 386 | for (const name of [ |
| 387 | "FORM_GUARD", |
| 388 | "HERENOW_API_KEY", |
| 389 | "HERENOW_SITE_SLUG", |
| 390 | "TURNSTILE_RATE_LIMITER", |
| 391 | "TURNSTILE_HOSTNAMES", |
| 392 | "TURNSTILE_SECRET_KEY", |
| 393 | ]) { |
| 394 | if (!env[name]) { |
| 395 | throw new RequestError( |
| 396 | 503, |
| 397 | "gateway_not_configured", |
| 398 | "Form protection is temporarily unavailable.", |
| 399 | ); |
| 400 | } |
| 401 | } |
| 402 | } |
| 403 | |
| 404 | async function readJsonBody(request) { |
| 405 | const contentType = request.headers.get("Content-Type") || ""; |