Type Parameters

Constructors

Properties

contentType: null | ContentTypeOption

The detected content type for the response. This is used to set the Content-Type header.

metadata: Readonly<Metadata>

The metadata for the response. This is used to set the revalidation times and other metadata.

A render result that represents an empty response. This is used to represent a response that was not found or was already sent.

Accessors

  • get isDynamic(): boolean
  • Returns false if the response is a string. It can be a string if the page was prerendered. If it's not, then it was generated dynamically.

    Returns boolean

  • get isNull(): boolean
  • Returns true if the response is null. It can be null if the response was not found or was already sent.

    Returns boolean

Methods

  • Parameters

    Returns void

  • Pipes the response to a writable stream. This will close/cancel the writable stream if an error is encountered. If this doesn't throw, then the writable stream will be closed or aborted.

    Parameters

    Returns Promise<void>

  • Pipes the response to a node response. This will close/cancel the node response if an error is encountered.

    Returns Promise<void>

  • Chains a new stream to the response. This will convert the response to an array of streams if it is not already one and will add the new stream to the end. When this response is piped, all of the streams will be piped one after the other.

    Parameters

    • readable: ReadableStream<Uint8Array<ArrayBufferLike>>

      The new stream to chain

    Returns void

  • Returns the response if it is a string. If the page was dynamic, this will return a promise if the stream option is true, or it will throw an error.

    Parameters

    • Optional stream: false

      Whether or not to return a promise if the response is dynamic

    Returns string

    The response as a string

  • Parameters

    • stream: true

    Returns Promise<string>

  • Unshifts a new stream to the response. This will convert the response to an array of streams if it is not already one and will add the new stream to the start of the array. When this response is piped, all of the streams will be piped one after the other.

    Parameters

    • readable: ReadableStream<Uint8Array<ArrayBufferLike>>

      The new stream to unshift

    Returns void