howdy/context/body
Body handles the request body helper methods.
This relys on being passed the Context, and will interigate the request object.
Functions
pub fn get_form(context in: Context) -> Result(
Map(String, String),
Nil,
)
Gets the request body as a key/value Map This is designed to work with HTML standard Post methods.
Note: this does not support multipart forms
Example:
get_form(context)
pub fn get_json(context in: Context, decoder: fn(Dynamic) ->
Result(a, List(DecodeError))) -> Result(a, DecodeError)
Gets the body of the request as Json. It will return an Error if it is unable to decode the contents of the request body as a Json object.
Example:
get_json(context, dynamic.decode2(
Input,
field("test", of: dynamic.string),
field("name", of: dynamic.string),
))