Boost C++ Libraries

PrevUpHomeNext

Struct header_arg

boost::taar::handler::header_arg — Argument provider that reads a request header.

Synopsis

// In header: <boost/taar/handler/rest_arg.hpp>


struct header_arg {

  // public member functions
  header_arg(std::string, std::string = {});
  header_arg(boost::beast::http::field, std::string = {});
  std::string const & description() const;
  std::string name() const;
  taar::result< std::string > 
  operator()(boost::beast::http::request_header<> const &, 
             matcher::context const &) const;

  // public data members
  std::variant< boost::beast::http::field, std::string > header_;
  std::string description_;
};

Description

Accepts either a boost::beast::http::field constant for well-known headers or a raw string name. If the same header is present more than once with conflicting values the provider reports error::argument_ambiguous.

header_arg public member functions

  1. header_arg(std::string header_name, std::string description = {});
  2. header_arg(boost::beast::http::field field, std::string description = {});
  3. std::string const & description() const;
  4. std::string name() const;
  5. taar::result< std::string > 
    operator()(boost::beast::http::request_header<> const & request, 
               matcher::context const &) const;

PrevUpHomeNext