Creates an HttpRes instance from a standard Web API Response object.
Used for interoperability — copies the given Response into a new
IHttpRes builder instance so you can further modify it before
sending. The original Response is not mutated.
Useful for integrating with fetch responses or libraries that rely
on the WinterTC standard (e.g. Better Auth).
The source Response object to copy from.
A new IHttpRes instance wrapping the response.
Replaces the response with a JSON body and
Content-Type: application/json.
The data to serialize as JSON.
Optionalschema: StandardSchemaV1<unknown, TData>An optional Standard Schema to validate the data before serialization. When provided, the data is validated against the schema and only valid data is serialized. Omit to skip validation.
Helper methods for creating common IHttpRes instances.
Provides convenience factories for JSON, HTML, plain text, redirect, and 404 responses, as well as a method to wrap an existing Web API
Responseinto an IHttpRes builder.These methods are available directly on the handler and middleware arguments via HttpHandlerArgs (which extends this type). You typically call them as
json(...),redirect(...), etc. from within a handler or middleware function.IMPORT_PATH:
"@daiso-tech/core/http-router/contracts"