Server response class.

Hierarchy

  • ServerResponse

Constructors

  • Parameters

    • sendResponse: SendResponse

    Returns ServerResponse

Properties

_ctx: undefined | WeakRef<Context> = undefined
_sendResponse: SendResponse
headers: Headers = ...

Response headers.

isSent: boolean = false

Response has already been sent.

statusCode: number = 200

Response status code.

statusMessage: null | string = null

Response status message.

Methods

  • Append header value.

    Parameters

    • name: string
    • value: string

    Returns ServerResponse

  • Bind context to response.

    Parameters

    Returns void

  • Set response content length.

    Parameters

    • len: number

    Returns ServerResponse

  • Send response.

    Parameters

    • Optional body: string | Stream | Buffer

    Returns Promise<void>

  • Set HTTP header for response.

    Parameters

    • name: string
    • value: string

    Returns ServerResponse

  • Set response status.

    Parameters

    • code: number
    • Optional message: string

    Returns ServerResponse

  • Set response content type.

    Parameters

    • type: string

    Returns ServerResponse

Generated using TypeDoc