( location: string | URL, options?: Options.WithContent | undefined )
| 141 | * @since 4.0.0 |
| 142 | */ |
| 143 | export const redirect = ( |
| 144 | location: string | URL, |
| 145 | options?: Options.WithContent | undefined |
| 146 | ): HttpServerResponse => { |
| 147 | const headers = Headers.fromRecordUnsafe({ location: location.toString() }) |
| 148 | return makeResponse({ |
| 149 | status: options?.status ?? 302, |
| 150 | statusText: options?.statusText, |
| 151 | headers: options?.headers |
| 152 | ? Headers.merge(headers, Headers.fromInput(options.headers)) |
| 153 | : headers, |
| 154 | cookies: options?.cookies ?? Cookies.empty |
| 155 | }) |
| 156 | } |
| 157 | |
| 158 | /** |
| 159 | * Creates an HTTP response whose body is a `Uint8Array`. |
nothing calls this directly
no test coverage detected