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>
  • A promise which resolves to the request body

    Returns Promise<Buffer>

  • get path(): string
  • Get the request path without hash or search

    Returns string

  • get query(): ParsedUrlQuery
  • Get the parsed query params

    Returns ParsedUrlQuery

Methods

  • Gets the body

    Parameters

    • format: "buffer"

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

    Returns Promise<Buffer>

  • 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, any>>

  • Parse the body using conten-type header

    Parameters

    • body: Buffer

      The body

    Returns string | Buffer | Record<string, any>