Class MoxyRequest

Hierarchy

  • IncomingMessage
    • MoxyRequest

Constructors

Properties

Accessors

Methods

Constructors

Properties

id: string

Unique request UUID

timestamp: number

The unix timestamp of the request

Accessors

  • get body(): Promise<Buffer<ArrayBufferLike>>

    A promise which resolves to the request body

    Returns Promise<Buffer<ArrayBufferLike>>

  • get path(): undefined | string

    Get the request path without hash or search

    Returns undefined | string

Methods

  • Gets the body

    Parameters

    • format: "buffer"

      The desired body format (defaults to content-type header)

    Returns Promise<Buffer<ArrayBufferLike>>

  • Gets the body

    Parameters

    • format: "string"

      The desired body format (defaults to content-type header)

    Returns Promise<string>

  • Gets the body

    Parameters

    • format: "json"

      The desired body format (defaults to content-type header)

    Returns Promise<Record<string, unknown>>

  • Parse the body using conten-type header

    Parameters

    • body: Buffer

      The body

    Returns string | Buffer<ArrayBufferLike> | Record<string, unknown>