Class MoxyResponse

Hierarchy

Constructors

Properties

duration: number

Request duration in ms

id: string

Unique request UUID

Accessors

  • get body(): string | Buffer | Record<string, any>
  • The response body

    Returns string | Buffer | Record<string, any>

Methods

  • Overwrite writableend to store body internally

    Parameters

    • ...args: any[]

      The arguments

    Returns this

  • Gets the content type from file extention

    Parameters

    • filename: string

      The filename

    Returns string

  • Parse the response body based on content-type

    Parameters

    • body: Buffer

      The body

    Returns string | Buffer | Record<string, any>

  • Set response headers The writeHead method buffers headers, so they are not available for logging without calling setHeaders

    Parameters

    • headers: Record<string, string | number | readonly string[]>

      The headers

    Returns void

  • Override writablewrite to store body internally

    Parameters

    • chunk: string

      The chunk

    • ...args: any[]

      The arguments

    Returns boolean