(body: unknown, ok = true)
| 18 | } from "./update-check"; |
| 19 | |
| 20 | const jsonResponse = (body: unknown, ok = true): Response => |
| 21 | new Response(JSON.stringify(body), { |
| 22 | status: ok ? 200 : 500, |
| 23 | headers: { "content-type": "application/json" }, |
| 24 | }); |
| 25 | |
| 26 | const fetchReturning = (body: unknown, ok = true): typeof fetch => |
| 27 | (async () => jsonResponse(body, ok)) as typeof fetch; |