View Source Apical.Plugs.RequestBody (apical v0.2.1)
Plug module for parsing request bodies and placing them into params.
There are several forms that the RequestBody plug may take. The following forms are recognized:
connobject for parsing the RequestBody plugs by obtaining the
content-lengthheader and setting private
Raises appropriate errors early in the case that these headers are missing.
Rejects request bodies with a 415 error since the supplied content-type does not match any media-types declared in the OpenAPI schema.
[router_module, operation_id, media_type_string, parameters, plug_opts]
The router module is passed itself, the operation_id (as an atom), the media-type string for which the module applies, the requestBody map from the OpenAPI schema, and the plug_opts keyword list as elucidated by the router compiler.
conn output for media-type plugs
content-type header doesn't match the media-type string declared in
the OpenApi schema, it is untouched. Note that if it fails to match it
should be caught by a
:not_matched variant of the plug downstream.
Depending on the RequestBody source plugin supplied, the
conn struct after
calling this plug may have the request body placed into the
It may or may not also trigger reading the conn's request body. Note that
fetching the request body may happen only once in the
By default, the plugins are assigned to the media types as follows:
See documentation for the respective source plugins for more information.