Stone.js API
    Preparing search index...

    Class representing a RedirectBrowserResponse.

    Mr. Stone evensstone@gmail.com

    Hierarchy (View Summary)

    Index
    _content: unknown

    The content of the response.

    _statusCode?: number

    The status code of the response.

    _statusMessage?: string

    The status message of the response.

    metadata: Record<string, unknown>

    The metadata associated with the event.

    originalContent: unknown

    The original content of the response.

    prepared: boolean

    The prepared status of the response.

    source?: object

    The source of the event.

    targetUrl?: string | URL
    timeStamp: number

    The timestamp of the event creation.

    type: string

    The type of the event.

    OUTGOING_BROWSER_RESPONSE: "stonejs@outgoing_browser_response" = 'stonejs@outgoing_browser_response'
    REDIRECT_BROWSER_RESPONSE: "stonejs@redirect_browser_response" = 'stonejs@redirect_browser_response'
    • get content(): unknown

      Gets the content of the outgoing response.

      Returns unknown

      The content of the outgoing response.

    • get isPrepared(): boolean

      Gets the prepared status of the outgoing response.

      Returns boolean

      The prepared status of the response.

    • get statusCode(): number

      Gets the status code of the outgoing response.

      Returns number

      The status code of the response, or undefined if not set.

    • get statusMessage(): string

      Gets the status message of the outgoing response.

      Returns string

      The status message of the response, or undefined if not set.

    • 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.

      Returns this

      A cloned instance of the current class.

    • Get data from metadata.

      Type Parameters

      • TReturn = unknown

      Parameters

      • key: string

        The key to retrieve from metadata.

      Returns TReturn

      The value associated with the key or the fallback.

    • Get data from metadata.

      Type Parameters

      • TReturn = unknown

      Parameters

      • key: string

        The key to retrieve from metadata.

      • fallback: TReturn

        The fallback value if the key is not found.

      Returns TReturn

      The value associated with the key or the fallback.

    • Get data from metadata.

      Type Parameters

      • TReturn = unknown

      Parameters

      • key: string

        The key to retrieve from metadata.

      Returns TReturn

      The value associated with the key or the fallback.

    • Get data from metadata.

      Type Parameters

      • TReturn = unknown

      Parameters

      • key: string

        The key to retrieve from metadata.

      • fallback: TReturn

        The fallback value if the key is not found.

      Returns TReturn

      The value associated with the key or the fallback.

    • Check if the given value is equal to the specified value.

      Parameters

      • key: string

        The key to check.

      • value: unknown

        The value to compare against.

      Returns boolean

      True if the key's value is equal to the specified value, false otherwise.

    • Check if the status code represents an informational response (1xx).

      Returns boolean

      True if the status code is informational, otherwise false.

    • Check if the status code represents a successful response (2xx).

      Returns boolean

      True if the status code is successful, otherwise false.

    • Check if the status code represents a redirection response (3xx).

      Returns boolean

      True if the status code is a redirection, otherwise false.

    • Check if the status code represents a client error response (4xx).

      Returns boolean

      True if the status code is a client error, otherwise false.

    • Check if the status code represents a server error response (5xx).

      Returns boolean

      True if the status code is a server error, otherwise false.

    • 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.

    • Check if the status code is 403 (Forbidden).

      Returns boolean

      True if the status code is 403, otherwise false.

    • 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.

    • Check if the status code is invalid.

      Returns boolean

      True if the status code is invalid, otherwise false.

    • 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.

    • Check if the status code is 404 (Not Found).

      Returns boolean

      True if the status code is 404, otherwise false.

    • Check if the status code is 200 (OK).

      Returns boolean

      True if the status code is 200, otherwise false.

    • Check if the status code is 401 (Unauthorized).

      Returns boolean

      True if the status code is 401, otherwise false.

    • Prepare response before sending it.

      Parameters

      • _event: IncomingEvent

        The incoming event associated with this response.

      • Optional_container: Container

        The container.

      Returns Promiseable<RedirectBrowserResponse>

      This OutgoingResponse instance.

    • Set the content of the response.

      Parameters

      • content: unknown

        The content to set.

      Returns this

      This OutgoingResponse instance.

    • Add data to metadata.

      Parameters

      • key: string | Record<string, unknown>

        The key or object to add to metadata.

      • Optionalvalue: unknown

        The value to associate with the key.

      Returns this

      This Event instance.

    • Set the prepared status of the response.

      Parameters

      • prepared: boolean

        The prepared status to set.

      Returns this

      This OutgoingResponse instance.

    • Set the status code of the response.

      Parameters

      • code: number

        The status code.

      • Optionaltext: string

        Optional status message.

      Returns this

      This OutgoingResponse instance.

    • Create an instance of RedirectBrowserResponse from the given path or URL.

      Parameters

      • url: string | URL

        The path or URL to redirect to. If a string is provided, it will be treated as a relative path.

      • statusCode: number = 302

        The HTTP status code for the redirect (default is 302).

      Returns RedirectBrowserResponse

      A new instance of RedirectBrowserResponse.

    OUTGOING_RESPONSE: string

    OUTGOING_RESPONSE Event name, fires on response to the incoming event.

    OutgoingResponse#OUTGOING_RESPONSE