Interface RenderMeans

HTTP response body render means.

It is implied that response body is generated by these means only. I.e. nothing is written to ServerResponse directly.

All renderXXX methods write Content-Length header. They skip writing content body when request method is HEAD.

Hierarchy

  • RenderMeans

Methods

  • Renders response body.

    Parameters

    • this: void
    • body: string | Buffer

      Response body text or Buffer.

    • Optional encoding: BufferEncoding

      Response body buffer encoding. Ignored for buffer.

    Returns void

  • Renders HTML response body.

    Generates content in UTF-8 encoding and sets Content-Type: text/html; charset=utf-8 header.

    Parameters

    • this: void
    • html: string | Buffer

      HTML response text or Buffer.

    Returns void

  • Renders JSON response body.

    Generates content in UTF-8 encoding and sets Content-Type: application/json; charset=utf-8 header.

    Parameters

    • this: void
    • body: unknown

      JSON object to stringify.

    Returns void

Generated using TypeDoc