import { IContainer } from '@stone-js/core'; import { IncomingHttpEvent } from './IncomingHttpEvent.js'; import { OutgoingHttpResponse, OutgoingHttpResponseOptions } from './OutgoingHttpResponse.js'; /** * Options for creating a Redirect HTTP Response. */ export interface RedirectResponseOptions extends OutgoingHttpResponseOptions { url: string | URL; } /** * Class representing a RedirectResponse. * * @author Mr. Stone */ export declare class RedirectResponse extends OutgoingHttpResponse { static readonly OUTGOING_HTTP_RESPONSE = "stonejs@outgoing_http_redirect_response"; private targetUrl?; /** * Create an instance of RedirectResponse from the given path or URL. * * @param url - The path or URL to redirect to. If a string is provided, it will be treated as a relative path. * @param statusCode - The HTTP status code for the redirect (default is 302). * @returns A new instance of RedirectResponse. */ static to(url: string | URL, statusCode?: number): RedirectResponse; /** * Create a RedirectResponse. * * @param options - Options for creating the RedirectResponse. * @throws HttpError if the status code is not a redirect code. */ constructor(options: RedirectResponseOptions); /** * Set target URL. * * @param url - The target URL to set. * @returns The current instance for method chaining. * @throws HttpError if the URL is empty. */ setTargetUrl(url: string | URL): this; /** * Prepare the response before sending. * * @param event - The incoming HTTP event. * @param container - The service container. * @returns The current instance of the response for chaining. */ prepare(event: IncomingHttpEvent, container?: IContainer): Promise; /** * Prepare the redirection. * * @returns The current instance for method chaining. */ private prepareRedirection; /** * Set the Location header for the response. * * @returns The current instance for method chaining. */ private location; /** * Resolve a safe `back` target: the Referer only when it points to the same origin, else `/`. * * @returns The safe back URL. */ private resolveSafeBackUrl; /** * Check if the headers include Cache-Control. * * @returns True if Cache-Control is present, otherwise false. */ private hasCacheControl; }