Support for describing and controlling expected return types. The
high-level functions (porcelain_returning_json
and
porcelain_returning_binary
) should be generally used.
porcelain_returning(content_type, process, validate, status_code = 200L)
porcelain_returning_json(schema = NULL, root = NULL, status_code = 200L)
porcelain_returning_binary(status_code = 200L)
porcelain_returning_text(status_code = 200L)
The MIME content type for the endpoint,
e.g. text/plain
, application/json
.
A processing function that will convert the output
of the handler function into something of the type
content_type
. This should be independent of arguments
passed to the endpoint, so practically this is the final stage
of serialisation.
A function that validates the return value and
throws an error if the output is not expected. This will only
be used if the endpoint is created with validate = TRUE
.
The HTTP status code that the endpoint will use on a successful return. The default of 200 should be reasonable.
The name of the json schema to use
The root of the schema directory.