Class: RedirectBrowserResponse
Class: RedirectBrowserResponse
Class representing a RedirectBrowserResponse.
Author
Mr. Stone evensstone@gmail.com
Extends
Constructors
Constructor
new RedirectBrowserResponse(options): RedirectBrowserResponse;
Create a RedirectBrowserResponse.
Parameters
options
RedirectBrowserResponseOptions
Options for creating the RedirectBrowserResponse.
Returns
RedirectBrowserResponse
Throws
HttpError if the status code is not a redirect code.
Overrides
OutgoingBrowserResponse
.constructor
Properties
targetUrl?
readonly optional targetUrl: string | URL;
OUTGOING_BROWSER_RESPONSE
static OUTGOING_BROWSER_RESPONSE: string = 'stonejs@redirect_browser_response';
Overrides
OutgoingBrowserResponse
.OUTGOING_BROWSER_RESPONSE
Methods
is1xx()
is1xx(): boolean;
Check if the status code represents an informational response (1xx).
Returns
boolean
True if the status code is informational, otherwise false.
Inherited from
is2xx()
is2xx(): boolean;
Check if the status code represents a successful response (2xx).
Returns
boolean
True if the status code is successful, otherwise false.
Inherited from
is3xx()
is3xx(): boolean;
Check if the status code represents a redirection response (3xx).
Returns
boolean
True if the status code is a redirection, otherwise false.
Inherited from
is4xx()
is4xx(): boolean;
Check if the status code represents a client error response (4xx).
Returns
boolean
True if the status code is a client error, otherwise false.
Inherited from
is5xx()
is5xx(): boolean;
Check if the status code represents a server error response (5xx).
Returns
boolean
True if the status code is a server error, otherwise false.
Inherited from
isError()
isError(): boolean;
Check if the status code is an error (i.e., 4xx or 5xx).
Returns
boolean
True if the status code is an error, otherwise false.
Inherited from
OutgoingBrowserResponse
.isError
isForbidden()
isForbidden(): boolean;
Check if the status code is 403 (Forbidden).
Returns
boolean
True if the status code is 403, otherwise false.
Inherited from
OutgoingBrowserResponse
.isForbidden
isInStatusRange()
isInStatusRange(start, end): boolean;
Check if the status code falls within the specified range.
Parameters
start
number
The starting value of the range (inclusive).
end
number
The ending value of the range (exclusive).
Returns
boolean
True if the status code is within the specified range, otherwise false.
Inherited from
OutgoingBrowserResponse
.isInStatusRange
isInvalid()
isInvalid(): boolean;
Check if the status code is invalid.
Returns
boolean
True if the status code is invalid, otherwise false.
Inherited from
OutgoingBrowserResponse
.isInvalid
isNotError()
isNotError(): boolean;
Check if the status code is not an error (i.e., not 4xx or 5xx).
Returns
boolean
True if the status code is not an error, otherwise false.
Inherited from
OutgoingBrowserResponse
.isNotError
isNotFound()
isNotFound(): boolean;
Check if the status code is 404 (Not Found).
Returns
boolean
True if the status code is 404, otherwise false.
Inherited from
OutgoingBrowserResponse
.isNotFound
isOk()
isOk(): boolean;
Check if the status code is 200 (OK).
Returns
boolean
True if the status code is 200, otherwise false.
Inherited from
isUnauthorized()
isUnauthorized(): boolean;
Check if the status code is 401 (Unauthorized).
Returns
boolean
True if the status code is 401, otherwise false.
Inherited from
OutgoingBrowserResponse
.isUnauthorized
create()
static create(options): RedirectBrowserResponse;
Create an instance of RedirectBrowserResponse.
Parameters
options
RedirectBrowserResponseOptions
Options for the outgoing browser response.
Returns
RedirectBrowserResponse
A new instance of RedirectBrowserResponse.
Overrides
OutgoingBrowserResponse
.create
to()
static to(url, statusCode): RedirectBrowserResponse;
Create an instance of RedirectBrowserResponse from the given path or URL.
Parameters
url
The path or URL to redirect to. If a string is provided, it will be treated as a relative path.
string
| URL
statusCode
number
= 302
The HTTP status code for the redirect (default is 302).
Returns
RedirectBrowserResponse
A new instance of RedirectBrowserResponse.