7#include <llhttp/llhttp.h>
12 static inline llhttp_method http_method_from_str(
const std::string_view& s)
14 const auto hashed_name = ccf::ds::fnv_1a<size_t>(s);
16#define XX(num, name, string) \
17 case (ccf::ds::fnv_1a<size_t>(#string)): \
19 return llhttp_method(num); \
28 throw std::logic_error(fmt::format(
"Unknown HTTP method '{}'", s));
51 RESTVerb(
const llhttp_method& hm) : verb(hm) {}
54 verb = http_method_from_str(s.c_str());
59 return static_cast<llhttp_method
>(verb);
64 return llhttp_method_name(
static_cast<llhttp_method
>(verb));
74 return verb == o.verb;
87 std::string s(verb.
c_str());
88 ccf::nonstd::to_lower(s);
96 throw std::runtime_error(fmt::format(
97 "Cannot parse RESTVerb from non-string JSON value: {}", j.dump()));
100 std::string s = j.get<std::string>();
101 ccf::nonstd::to_upper(s);
113 schema[
"type"] =
"string";
Definition rest_verb.h:45
RESTVerb()
Definition rest_verb.h:50
bool operator<(const RESTVerb &o) const
Definition rest_verb.h:67
RESTVerb(const llhttp_method &hm)
Definition rest_verb.h:51
RESTVerb(const std::string &s)
Definition rest_verb.h:52
bool operator!=(const RESTVerb &o) const
Definition rest_verb.h:77
std::optional< llhttp_method > get_http_method() const
Definition rest_verb.h:57
const char * c_str() const
Definition rest_verb.h:62
bool operator==(const RESTVerb &o) const
Definition rest_verb.h:72
Definition app_interface.h:14
void fill_json_schema(nlohmann::json &schema, const ClaimsDigest *)
Definition claims_digest.h:64
std::string schema_name(const ClaimsDigest *)
Definition claims_digest.h:59
void from_json(const nlohmann::json &j, ClaimsDigest &hash)
Definition claims_digest.h:54
void to_json(nlohmann::json &j, const ClaimsDigest &hash)
Definition claims_digest.h:49
#define XX(num, name, string)