![]() |
boost::taar::handler::json_body_arg — Argument provider that parses the request body as a JSON value.
// In header: <boost/taar/handler/rest_arg.hpp> struct json_body_arg { // public member functions template<typename... T> json_body_arg(T &&...); json_body_arg(all_content_types_t, description = {}); std::string name() const; std::string const & description() const; std::unordered_set< std::string > const & content_types() const; taar::result< boost::json::value > operator()(boost::beast::http::request< boost::beast::http::string_body > const &, matcher::context const &) const; // public data members std::unordered_set< std::string > content_types_; std::string description_; };
By default only requests with Content-Type: application/json are accepted; pass extra content types to the constructor or all_content_types to widen the set. Malformed JSON is reported as error::invalid_request_format.
json_body_arg public member functionstemplate<typename... T> json_body_arg(T &&... args);
json_body_arg(all_content_types_t, description d = {});
std::string name() const;
std::string const & description() const;
std::unordered_set< std::string > const & content_types() const;
taar::result< boost::json::value > operator()(boost::beast::http::request< boost::beast::http::string_body > const & request, matcher::context const &) const;