Boost C++ Libraries

PrevUpHomeNext

Struct string_body_arg

boost::taar::handler::string_body_arg — Argument provider that returns the request body as a std::string.

Synopsis

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


struct string_body_arg {

  // public member functions
  template<typename... T> string_body_arg(T &&...);
  string_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< std::string > 
  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_;
};

Description

By default the provider only matches requests whose Content-Type is in the list passed to the constructor (or "text/plain" if none were provided). Pass all_content_types to accept any content type. Mismatches are reported as error::invalid_content_type.

string_body_arg public member functions

  1. template<typename... T> string_body_arg(T &&... args);
  2. string_body_arg(all_content_types_t, description d = {});
  3. std::string name() const;
  4. std::string const & description() const;
  5. std::unordered_set< std::string > const & content_types() const;
  6. taar::result< std::string > 
    operator()(boost::beast::http::request< boost::beast::http::string_body > const & request, 
               matcher::context const &) const;

PrevUpHomeNext