Control for body parameters. This might change. There are several types of HTTP bodies that we want to consider here - the primary ones are a body uploaded in binary, the other is a json object. In the latter we want to validate the body against a schema (at least if validation is used). In future we might also support a form input here too.
porcelain_input_body_binary(name, content_type = NULL)
porcelain_input_body_json(name, schema = NULL, root = NULL, extract = NULL)
Name of the parameter
Content type for the input. If not given, then
application/octet-stream
is used. Provide a vector of valid
types to allow any of the types to be passed.
The name of the json schema to use
The root of the schema directory.
Optionally, the name of an element to extract from
the json. If given, then the body must be a json object (not an
array, for example) and extract
must refer to a top-level key
within it. We will extract the JSON string corresponding to
this key and forward that to the argument name
.
Deserialisation of the json is still the target function's
responsibility but there will be less of it.