14 #include <restinio/helpers/easy_parser.hpp> 16 #include <restinio/http_headers.hpp> 17 #include <restinio/request_handler.hpp> 63 template<
typename T >
89 "Parsed_Field_Type should have static try_parse method that " 90 "accepts string_view_t and returns " 91 "expected_t<Parsed_Field_Type, parse_error_t>" );
148 template<
typename Parsed_Field_Type,
typename Extra_Data >
153 const generic_request_t< Extra_Data > & req,
155 string_view_t field_name,
163 return try_extract_field_value_from< Parsed_Field_Type >(
164 req.header().opt_value_of( field_name ),
206 template<
typename Parsed_Field_Type,
typename Extra_Data >
211 const generic_request_t< Extra_Data > & req,
213 http_field_t field_id,
221 return try_extract_field_value_from< Parsed_Field_Type >(
222 req.header().opt_value_of( field_id ),
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.
auto try_parse_field(const generic_request_t< Extra_Data > &req, http_field_t field_id, string_view_t default_value=string_view_t{})
A helper function for extraction and parsing a value of 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...
A special type to be returned in the case if HTTP-field isn't found in a request. ...