Create a RedirectResponse.
Options for creating the RedirectResponse.
Protected Optional_Protected Optional_Protected_The content of the response.
Protected Readonly_Protected Optional_Protected Readonly_Protected Optional_Protected Optional_The status code of the response.
Protected Optional_The status message of the response.
ReadonlymetadataThe metadata associated with the event.
ReadonlyoriginalThe original content of the response.
ProtectedpreparedThe prepared status of the response.
Optional ReadonlysourceThe source of the event.
ReadonlytimeThe timestamp of the event creation.
ReadonlytypeThe type of the event.
Static ReadonlyOUTGOING_Get the blueprint associated with the response.
The blueprint or undefined if not set.
Get the character set encoding. Defaults to 'utf-8' if not explicitly set.
The character set encoding.
ProtectedcharsetProtected
Get the regular expression for matching charset in content type.
The regular expression for matching charset in content type.
Gets the content of the outgoing response.
The content of the outgoing response.
Get the ETag of the response.
The value of the ETag header, if present.
Get the headers of the response.
The headers of the response as a Headers object.
Gets the prepared status of the outgoing response.
The prepared status of the response.
Get the Last-Modified date of the response.
The value of the Last-Modified header, if present.
Get the HTTP status code.
The HTTP status code.
Gets the status code of the outgoing response.
The status code of the response, or undefined if not set.
Gets the status message of the outgoing response.
The status message of the response, or undefined if not set.
Get the Vary header as an array of values.
The Vary header values split by comma, or undefined if not present.
Add a field to the Vary header.
The field to add to the Vary header.
The current instance of OutgoingHttpResponse for chaining.
Append a value to an existing header or create a new header.
The header name.
The value to append.
The current instance of OutgoingHttpResponse for chaining.
ProtectedcalculateCalculate the content length.
The content length.
Clear a specific cookie from the response.
The name of the cookie to be cleared.
Optional settings for the cookie.
Whether to force the removal of the cookie, even if it doesn't exist.
The current instance of OutgoingHttpResponse for chaining.
Clear all cookies from the response.
Whether to force the removal of all cookies.
The current instance of OutgoingHttpResponse for chaining.
Return a cloned instance.
The metadata container is deep-copied (plain objects and arrays are recreated,
special values kept by reference) so that mutating the clone's metadata — e.g. via
middleware — never leaks back into the original event. This is what makes the
Kernel's originalEvent snapshot a faithful pre-middleware copy.
A cloned instance of the current class.
ProtecteddefaultGenerate a default ETag for the given content.
The content to generate an ETag for.
The encoding to use.
The generated ETag as a base64 string.
ProtectedensureEnsure that the "Content-Type" header has a charset specified.
The "Content-Type" header value.
The current instance of OutgoingHttpResponse for chaining.
Handles content negotiation based on the Accept header of the incoming request.
An object where keys are MIME types and values are functions that return the content for that MIME type.
The current instance of OutgoingHttpResponse for chaining.
Get data from metadata.
The key to retrieve from metadata.
The value associated with the key or the fallback.
ProtectedgetGet the hashed content using the specified encoding.
The content to hash.
The encoding to use for hashing.
The hashed content as a hexadecimal string.
Get a header value.
The header name.
The header value or the fallback value.
Get all header names.
An array of all header names.
Get data from metadata.
The key to retrieve from metadata.
The value associated with the key or the fallback.
ProtectedhandleHandle cache headers like ETag and Last-Modified.
The current instance of the response for chaining.
ProtectedhandleHandles content negotiation based on the Accept header of the incoming request.
The current instance of OutgoingHttpResponse for chaining.
Check if a specific header exists.
The header name to check.
True if the header exists, false otherwise.
Check if the given value is equal to the specified value.
The key to check.
The value to compare against.
True if the key's value is equal to the specified value, false otherwise.
Check if the status code represents an informational response (1xx).
True if the status code is informational, otherwise false.
Check if the status code represents a successful response (2xx).
True if the status code is successful, otherwise false.
Check if the status code represents a redirection response (3xx).
True if the status code is a redirection, otherwise false.
Check if the status code represents a client error response (4xx).
True if the status code is a client error, otherwise false.
Check if the status code represents a server error response (5xx).
True if the status code is a server error, otherwise false.
Check if the response is empty.
True if the status code indicates an empty response, otherwise false.
Check if the status code is an error (i.e., 4xx or 5xx).
True if the status code is an error, otherwise false.
Check if the status code is 403 (Forbidden).
True if the status code is 403, otherwise false.
Check if the status code falls within the specified range.
The starting value of the range (inclusive).
The ending value of the range (exclusive).
True if the status code is within the specified range, otherwise false.
Check if the status code is invalid.
True if the status code is invalid, otherwise false.
Check if the status code is 301 (Moved Permanently).
True if the status code is 301, otherwise false.
Check if the status code is not an error (i.e., not 4xx or 5xx).
True if the status code is not an error, otherwise false.
Check if the status code is 404 (Not Found).
True if the status code is 404, otherwise false.
Check if the status code is 200 (OK).
True if the status code is 200, otherwise false.
Check if the response is a redirect.
Optionallocation: string
The optional location to check for redirection.
True if the status code indicates a redirect, otherwise false.
Check if the status code is 205 (Reset Content).
True if the status code is 205, otherwise false.
Check if the status code is 401 (Unauthorized).
True if the status code is 401, otherwise false.
Check if the response is validateable.
True if the response has Last-Modified or ETag headers, otherwise false.
ProtectedmorphConvert the given content to a JSON string.
The content to convert.
Options to customize the serialization process.
A JSON string representation of the content.
Prepare the response before sending.
The incoming HTTP event.
Optionalcontainer: IContainer
The service container.
The current instance of the response for chaining.
ProtectedpreparePrepare content-related headers such as Content-Length and ETag.
The current instance of the response for chaining.
ProtectedpreparePrepare cookies by setting the appropriate headers.
The current instance of the response for chaining.
Remove headers from the response.
The header or headers to be removed.
The current instance of OutgoingHttpResponse for chaining.
Secure all cookies by setting the "Secure" attribute.
Whether to set or unset the "Secure" attribute for cookies.
The current instance of OutgoingHttpResponse for chaining.
Set the resolver for the blueprint.
A function that returns the blueprint.
The current instance of OutgoingHttpResponse for chaining.
Set the character set for the response.
The character encoding to use.
The current instance of OutgoingHttpResponse for chaining.
Set the response content. If the content should be JSON, it will be converted appropriately.
The content to set.
The JSON options.
The current instance of OutgoingHttpResponse for chaining.
ProtectedsetSet content headers such as Content-Length and ETag.
The current instance of the response for chaining.
ProtectedsetSet the content type if it's not already set.
The current instance of the response for chaining.
Set a cookie for the response.
The name of the cookie.
The value of the cookie.
Optional settings for the cookie.
The current instance of OutgoingHttpResponse for chaining.
Set the ETag for the response.
Optionaletag: string
The ETag value to set.
Whether the ETag should be marked as weak.
The current instance of OutgoingHttpResponse for chaining.
Set a single header for the response. If the header is "Content-Type," ensures charset is set appropriately.
The header name.
The value of the header.
The current instance of OutgoingHttpResponse for chaining.
Set multiple headers for the response.
A key-value pair of headers to be set.
The current instance of OutgoingHttpResponse for chaining.
Set the resolver for the incoming HTTP event.
A function that returns the incoming HTTP event.
The current instance of OutgoingHttpResponse for chaining.
Set the Last-Modified header for the response.
Optionaldate: Date
The date to set as the Last-Modified header.
The current instance of OutgoingHttpResponse for chaining.
Set link headers for the response.
An object representing links to set.
The current instance of OutgoingHttpResponse for chaining.
Add data to metadata.
The key or object to add to metadata.
Optionalvalue: unknown
The value to associate with the key.
This Event instance.
Set the prepared status of the response.
The prepared status to set.
This OutgoingResponse instance.
Set the HTTP status code of the response. Also sets a default status message if none is provided.
The HTTP status code.
Optionaltext: string
Optional status message.
The current instance of OutgoingHttpResponse for chaining.
Set the content type by file extension.
The file extension.
The current instance of OutgoingHttpResponse for chaining.
ProtectedshouldDetermine if the content should be serialized as JSON.
The content to check.
True if the content should be serialized as JSON, otherwise false.
ProtectedstringifyConvert the given value to a JSON string with optional escaping.
The value to convert.
Optionalreplacer: (this: unknown, key: string, value: unknown) => unknown
A function or array that alters the behavior of the stringification process.
Optionalspaces: string
The number of spaces to use for pretty-printing the JSON string.
Optionalescape: boolean
Whether to escape special characters.
The JSON string representation of the value.
StaticcreateCreate an instance of OutgoingHttpResponse.
Options for the outgoing HTTP response.
A new instance of OutgoingHttpResponse.
StatictoCreate an instance of RedirectResponse from the given path or URL.
The path or URL to redirect to. If a string is provided, it will be treated as a relative path.
The HTTP status code for the redirect (default is 302).
A new instance of RedirectResponse.
Class representing a RedirectResponse.
Author
Mr. Stone evensstone@gmail.com