Boost C++ Libraries

PrevUpHomeNext

Struct template method_t

boost::taar::matcher::method_t — A placeholder that produces matchers comparing against a request's HTTP method.

Synopsis

// In header: <boost/taar/matcher/method.hpp>

template<typename FieldsType = boost::beast::http::fields> 
struct method_t {
  // types
  typedef boost::beast::http::request_header< FieldsType > request_type;  // The request type these matchers accept. 

  // friend functions
  auto operator==(method_t, std::string);
};

Description

Instances of method_t are not consumed directly. Apply one of the relational operators to obtain a matcher that the session::http session can use to dispatch a request:

using boost::taar::matcher::method;
namespace http = boost::beast::http;

auto m = method == http::verb::get;          // matches GET
auto n = method != "PATCH";                  // matches anything but PATCH

Both boost::beast::http::verb values and arbitrary string verbs are accepted. The template parameter selects the request Fields type so matchers can be paired with non-default beast field containers.

The produced operand carries method_eq_constraint or method_ne_constraint metadata with the captured verb in its captures tuple.

Template Parameters

  1. typename FieldsType = boost::beast::http::fields

    The Beast HTTP fields container of the request to inspect. Defaults to boost::beast::http::fields.

method_t friend functions

  1. auto operator==(method_t, std::string verb);
    Match requests whose method-string equals verb.

PrevUpHomeNext