Class WayResponse

Fluent builder around Response for ergonomic reply construction.

return ctx.res.status(201).json({ created: true });
// or return ctx.res.ok({ created: true });

Constructors

Properties

_headers: Headers = ...
_last: null | Response = null
_status: number = 200

Accessors

Methods

  • HTTP 201 helper mirroring express' res.created.

    Parameters

    • Optional data: any

    Returns Response

  • Replace/append a header to the backing response state.

    Parameters

    • name: string
    • value: string

    Returns this

  • Serialize data as JSON and return a Response.

    Parameters

    • data: any

    Returns Response

  • Convenience 200 helper returning JSON when data is supplied.

    Parameters

    • Optional data: any

    Returns Response

  • Construct a Response using whatever body the caller supplies.

    Parameters

    • data: BodyInit

    Returns Response

  • Serialize data as plain text.

    Parameters

    • data: string

    Returns Response