import type { Response } from './server'; declare const REDIRECT_STATUSES: readonly [300, 301, 302, 303, 305, 307, 308]; declare const DEFAULT_REDIRECT_STATUS = 302; declare const TEXT_HTML_CONTENT_TYPE = "text/html"; declare const TEXT_PLAIN_CONTENT_TYPE = "text/plain"; export type RedirectStatus = (typeof REDIRECT_STATUSES)[number]; type DefaultValue = ContentType extends typeof TEXT_HTML_CONTENT_TYPE | typeof TEXT_PLAIN_CONTENT_TYPE | `${typeof TEXT_HTML_CONTENT_TYPE};${string}` | `${typeof TEXT_PLAIN_CONTENT_TYPE};${string}` ? string : null; /** * This hack is needed to use the provided generic types defaults rather than their inferred values. * For example, this should result in error because the default status is 302: * ```typescript * const response: Response<308, 'text/html', string, { Location: string }> = redirect('/'); * ``` * But it will pass if type inference is not prevented. */ type PreventGenericDefaultValueOverride = [T][T extends unknown ? 0 : never]; /** * Use to perform HTTP redirect. * @param url an absolute or relative URL string. Will be encoded with `encodeurl` and set as "Location" header (@see https://github.com/pillarjs/encodeurl). * @param options optional `status`, `contentType`, `value` that will override the default ones. Default `status` is 302, `contentType` is "text/html". * @returns redirect server response. */ export declare function redirect>(url: string, options?: { status?: Status; contentType?: ContentType; value?: Value; }): Response, PreventGenericDefaultValueOverride, PreventGenericDefaultValueOverride, { Location: string; }>; export {};