(location: string, init: ResponseInit = {})
| 108 | } |
| 109 | |
| 110 | function redirect(location: string, init: ResponseInit = {}): Response { |
| 111 | const { headers, status, ...rest } = init; |
| 112 | return withSecurityHeaders( |
| 113 | new Response(null, { |
| 114 | ...rest, |
| 115 | status: status ?? 302, |
| 116 | headers: headersWith({ location, 'cache-control': 'no-store' }, headers), |
| 117 | }), |
| 118 | ); |
| 119 | } |
| 120 | |
| 121 | /** |
| 122 | * Only same-origin absolute paths survive, so `?next=` can never become an open |
no test coverage detected