| 121 | } |
| 122 | |
| 123 | function redirect(location: string | URL, init?: ResponseInit | number): Response { |
| 124 | if (typeof init === "number") { |
| 125 | return new Response(`Redirecting to ${location}`, { |
| 126 | status: init, |
| 127 | headers: { |
| 128 | Location: location.toString(), |
| 129 | }, |
| 130 | }); |
| 131 | } |
| 132 | |
| 133 | return new Response(`Redirecting to ${location}`, { |
| 134 | status: 302, |
| 135 | ...init, |
| 136 | headers: { |
| 137 | Location: location.toString(), |
| 138 | ...init?.headers, |
| 139 | }, |
| 140 | }); |
| 141 | } |
| 142 | |
| 143 | async function renderPage(env: Env, node: VNode, init?: ResponseInit): Promise<Response> { |
| 144 | let assetsManifest = await loadAssetsManifest(env); |