Options
All
  • Public
  • Public/Protected
  • All
Menu

Class MoxyResponse

Hierarchy

  • ServerResponse
    • MoxyResponse

Index

Constructors

Properties

duration: number

Request duration in ms

id: string

Unique request UUID

Accessors

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

Methods

  • Overwrite writableend to store body internally

    Parameters

    • Rest ...args: any[]

      The arguments

    Returns MoxyResponse

  • getContentTypeFromFileExt(filename: string): string
  • Gets the content type from file extention

    Parameters

    • filename: string

      The filename

    Returns string

  • parseBody(body: Buffer): string | Record<string, any> | Buffer
  • Parse the response body based on content-type

    Parameters

    • body: Buffer

      The body

    Returns string | Record<string, any> | Buffer

  • setHeaders(headers: Record<string, string | number | readonly string[]>): void
  • 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

  • write(chunk: string, ...args: any[]): boolean
  • Override writablewrite to store body internally

    Parameters

    • chunk: string

      The chunk

    • Rest ...args: any[]

      The arguments

    Returns boolean

Generated using TypeDoc