import type { CacheEntry } from './cache-entry.ts'; import type { RegistryClientRequestOptions } from './index.ts'; export type RedirectStatus = 301 | 302 | 303 | 307 | 308; export type RedirectResponse = CacheEntry & { statusCode: RedirectStatus; getHeader(key: 'location'): Uint8Array | undefined; }; export declare const isRedirect: (response: CacheEntry) => response is RedirectResponse; /** * If this response is allowed to follow the redirect (because max has not * been hit, and the new location has not been seen already), then return * the [url, options] to use for the subsequent request. * * Return [] if the response should be returned as-is. * * Throws an error if maxRedirections is hit or the redirections set already * contains the new location. * * Ensure that the response is in fact a redirection first, by calling * {@link isRedirect} on it. */ export declare const redirect: (options: RegistryClientRequestOptions, response: RedirectResponse, from: URL) => [] | [URL, RegistryClientRequestOptions];