( location: string | URL, options?: Options.WithContent | undefined )
| 156 | * @since 4.0.0 |
| 157 | */ |
| 158 | export const redirect = ( |
| 159 | location: string | URL, |
| 160 | options?: Options.WithContent | undefined |
| 161 | ): HttpServerResponse => { |
| 162 | const headers = Headers.fromRecordUnsafe({ location: location.toString() }) |
| 163 | return makeResponse({ |
| 164 | status: options?.status ?? 302, |
| 165 | statusText: options?.statusText, |
| 166 | headers: options?.headers |
| 167 | ? Headers.merge(headers, Headers.fromInput(options.headers)) |
| 168 | : headers, |
| 169 | cookies: options?.cookies ?? Cookies.empty |
| 170 | }) |
| 171 | } |
| 172 | |
| 173 | /** |
| 174 | * Creates an HTTP response whose body is a `Uint8Array`. |
nothing calls this directly
no test coverage detected