Routes
Zeta automatically converts values returned from the handler to a Response object.
To return a value from a handler, you must define a response schema.
;
;
This indicates the response schema for the 200 OK status code.
When you need to document or return a status code other than 200 OK, you must define a schema for each status code.
;
;
;
;
You need to use status to return a value when using multiple status codes.
You never need to include a schema for the 400 Bad Request status code. Zeta automatically adds this to all requests that include a input/output schema.
This is the schema used to indicate the standard error response. You must use it for all error status codes.
;
// ...
responses:
Use this schema to indicate that a response does not have a response body.
;
// ...
responses:
The request context provides a set object which is used to set response headers.
;
Zeta will add any headers set on the set.headers object to the response for you.
Content-TypeThe Content-Type header is special. Because OpenAPI also needs to know the content type of the response, you define this header on the response schema, not in the handler, via the contentType metadata.
;
;
Zeta automatically uses the response schema's metadata to set the Content-Type header.