#include <formCodec.hpp>
Static Public Member Functions | |
| static std::string_view | mediaType () noexcept |
| static anch::rest::FormLimits & | limits (anch::codec::Side side) |
| static void | serialize (const anch::rest::Form &form, std::ostream &out) |
| static void | deserialize (anch::rest::Form &form, std::istream &input, const anch::codec::MediaType &contentType, anch::codec::Side side) |
| template<anch::rest::FormMapped T> | |
| static void | serialize (const T &value, std::ostream &out, anch::codec::Side side) |
| template<anch::rest::FormMapped T> | |
| static void | deserialize (T &value, std::istream &input, const anch::codec::MediaType &contentType, anch::codec::Side side) |
| static std::string | encode (std::string_view value) |
application/x-www-form-urlencoded codec for Form (fields only).
Values are written with the WHATWG URL-encoded serializer (space is + ). On reading, + is a space, empty pairs are ignored and a pair without = is a field with an empty value. Content is UTF-8: another charset is refused.
Types with a FormMapper are read and written through a Form .
|
static |
Read form
| form | the form to fill |
| input | the input stream |
| contentType | the body media type |
| side | the side which reads form |
| std::invalid_argument | when encoding is invalid or when charset is not UTF-8 |
| ContentTooLarge | when body is over limits |
|
static |
Read value mapped with its FormMapper
| T | the value type |
| value | the value to fill |
| input | the input stream |
| contentType | the body media type |
| side | the side which reads value |
|
static |
Encode value with the WHATWG URL-encoded serializer: ASCII alphanumeric characters and *-._ are kept, space is + , other bytes are percent-encoded
| value | the value |
|
static |
Get limits of a side, to change before handling requests. Default: 2 MiB body, 1000 fields.
| side | the side |
|
staticnoexcept |
Media type
application/x-www-form-urlencoded
|
static |
Write form
| form | the form |
| out | the output stream |
| std::invalid_argument | when form has a file part |
|
static |
Write value mapped with its FormMapper
| T | the value type |
| value | the value |
| out | the output stream |
| side | the side which writes value |
| std::invalid_argument | when form has a file part |