Fake Mirrors
    Preparing search index...

    Complete HTTP message representation with request and response components. Supports normal HTTP and WebSocket messages with interceptor pipelines.

    Constructors

    • Create a new message instance.

      Parameters

      • type:
            | "normal-simple"
            | "normal-stream-request"
            | "normal-stream-response"
            | "websocket"

        The message type

      Returns HttpMessage

    Properties

    analyze: string | null = null

    Analyze queue job name

    connection: HttpConnection = {}

    Connection metadata

    errors: HttpError[] = []

    Accumulated errors during processing

    id: string = ...

    Unique message ID

    Method wrapper instance

    payload: HttpPayload = {}

    Message payload data

    requestBody: HttpBodyWrap

    Request body wrapper instance

    requestHeaders: HttpHeadersWrap

    Request headers wrapper instance

    responseBody: HttpBodyWrap

    Response body wrapper instance

    responseHeaders: HttpHeadersWrap

    Response headers wrapper instance

    Response status wrapper instance

    Url wrapper instance

    Accessors

    • get type(): | "normal-simple"
      | "normal-stream-request"
      | "normal-stream-response"
      | "websocket"

      Get message type.

      Returns
          | "normal-simple"
          | "normal-stream-request"
          | "normal-stream-response"
          | "websocket"

      Current message type

    Methods

    • Register content-types for a category.

      Parameters

      • name: "text" | "json" | "html" | "css" | "javascript" | "xml" | "urlEncoded"

        Content type category

      • types: string[]

        Array of MIME types

      Returns void

      Error if message is ready

    • Add error with path context.

      Parameters

      • error: unknown

        Error object or unknown value

      • path: string[]

        Error location path segments

      Returns void

    • Add stream transform for request body.

      Parameters

      • transform: Transform

        Transform stream

      Returns void

      Error if message is ready

    • Add stream transform for response body.

      Parameters

      • transform: Transform

        Transform stream

      Returns void

      Error if message is ready

    • Add content-types eligible for URL rewriting.

      Parameters

      • types: string[]

        Array of MIME types

      Returns void

      Error if message is ready

    • Check if value is absolute URL.

      Parameters

      • value: string

        URL string to check

      Returns boolean

      true if absolute URL

    • Check if content-type belongs to category.

      Parameters

      • name: "text" | "json" | "html" | "css" | "javascript" | "xml" | "urlEncoded"

        Content type category

      • contentType: HttpContentType

        Parsed content-type to check

      Returns boolean

      true if content-type matches category, false otherwise

    • Rewrite URLs in text.

      Parameters

      • text: string

        Text content containing URLs

      • rev: boolean

        Reverse rewriting (mirror to donor)

      • targets: RewriteUrlTarget[]

        URL rewrite targets

      Returns string

      Text with rewritten URLs

    • Run all registered request body interceptors in order. This method freezes headers and body after execution.

      Returns void

      Error if message is not ready

    • Run all registered request head interceptors in order. This method freezes method and URL after execution.

      Returns void

      Error if message is not ready

    • Run all registered response body interceptors in order. This method freezes headers and body after execution.

      Returns void

      Error if message is not ready

    • Run all registered response head interceptors in order. This method freezes status after execution.

      Returns void

      Error if message is not ready

    • Set message type with validation.

      Parameters

      • type:
            | "normal-simple"
            | "normal-stream-request"
            | "normal-stream-response"
            | "websocket"

        New message type

      Returns void

      Error if message is ready or invalid type transition