14 #include <restinio/helpers/http_field_parsers/media-type.hpp> 77 const auto media_type = media_type_value_t::make_weight_aware_parser();
79 return produce< accept_value_t >(
80 maybe_empty_comma_separated_list_p< item_container_t >(
82 media_type >> &item_t::media_type,
84 weight_p() >> &item_t::weight,
85 params_with_opt_value_p() >> &item_t::accept_params
88 ) >> &accept_value_t::items
101 return restinio::easy_parser::try_parse( what, make_parser() );
expected_t< std::optional< string_view_t >, not_found_t > find_first(const parameter_with_optional_value_container_t &where, string_view_t what)
A helper function to find the first occurence of a parameter with the specified value.
Tools for working with the value of Accept HTTP-field.
std::enable_if< std::is_same< Parameter_Container, query_string_params_t >::value||std::is_same< Parameter_Container, router::route_params_t >::value, std::optional< Value_Type > >::type opt_value(const Parameter_Container ¶ms, string_view_t key)
Gets the value of a parameter specified by key wrapped in std::optional<Value_Type> if parameter exis...
std::optional< qvalue_t > weight
media_type_value_t media_type
static expected_t< accept_value_t, restinio::easy_parser::parse_error_t > try_parse(string_view_t what)
An attempt to parse Accept HTTP-field.
static auto make_parser()
A factory function for a parser of Accept value.
accept_ext_container_t accept_params