drogon
C++14/17-based HTTP application framework
Loading...
Searching...
No Matches
HttpConstraint.h
1
14
15#pragma once
16
17#include <drogon/HttpTypes.h>
18#include <string>
19
20namespace drogon
21{
22namespace internal
23{
24enum class ConstraintType
25{
26 None,
27 HttpMethod,
28 HttpMiddleware
29};
30
31class HttpConstraint
32{
33 public:
34 HttpConstraint(HttpMethod method)
35 : type_(ConstraintType::HttpMethod), method_(method)
36 {
37 }
38
39 HttpConstraint(std::string middlewareName)
40 : type_(ConstraintType::HttpMiddleware),
41 middlewareName_(std::move(middlewareName))
42 {
43 }
44
45 HttpConstraint(const char *middlewareName)
46 : type_(ConstraintType::HttpMiddleware), middlewareName_(middlewareName)
47 {
48 }
49
50 ConstraintType type() const
51 {
52 return type_;
53 }
54
55 HttpMethod getHttpMethod() const
56 {
57 return method_;
58 }
59
60 const std::string &getMiddlewareName() const
61 {
62 return middlewareName_;
63 }
64
65 private:
66 ConstraintType type_{ConstraintType::None};
67 HttpMethod method_{HttpMethod::Invalid};
68 std::string middlewareName_;
69};
70} // namespace internal
71} // namespace drogon
Drogon Test is a minimal effort test framework developed because the major C++ test frameworks doesn'...
Definition Attribute.h:23