26 unsigned short statusCode;
27 std::string_view statusLine;
34 unsigned short statusCode,
35 std::string_view statusLine
36 ) : statusCode(statusCode),
37 statusLine(statusLine) {
43 operator int()
const {
return statusCode; }
44 operator short()
const {
return statusCode; }
45 operator std::string()
const {
return std::to_string(statusCode); }
47 bool operator==(
const StatusCode& other)
const {
48 return statusCode == other.statusCode;
51 bool operator==(
unsigned short code)
const {
52 return statusCode == code;
56 bool operator==(
long int code)
const {
57 return statusCode == (
unsigned short) code;
62 constexpr StatusCode Continue(100,
"Continue");
63 constexpr StatusCode SwitchingProtocols(101,
"Switching Protocols");
65 constexpr StatusCode OK(200,
"OK");
66 constexpr StatusCode Created(201,
"Created");
67 constexpr StatusCode Accepted(202,
"Accepted");
68 constexpr StatusCode NonAuthoritativeInformation(203,
"Non-Authoritative Information");
69 constexpr StatusCode NoContent(204,
"No Content");
70 constexpr StatusCode ResetContent(205,
"Reset Content");
71 constexpr StatusCode PartialContent(206,
"Partial Content");
73 constexpr StatusCode MultipleChoices(300,
"Multiple Choices");
74 constexpr StatusCode MovedPermanently(301,
"Moved Permanently");
75 constexpr StatusCode Found(302,
"Found");
76 constexpr StatusCode SeeOther(303,
"See Other");
77 constexpr StatusCode NotModified(304,
"Not Modified");
78 constexpr StatusCode TemporaryRedirect(307,
"Temporary Redirect");
79 constexpr StatusCode PermanentRedirect(308,
"Permanent Redirect");
81 constexpr StatusCode BadRequest(400,
"Bad Request");
82 constexpr StatusCode Unauthorized(401,
"Unauthorized");
83 constexpr StatusCode Forbidden(403,
"Forbidden");
84 constexpr StatusCode NotFound(404,
"Not Found");
85 constexpr StatusCode MethodNotAllowed(405,
"Method Not Allowed");
86 constexpr StatusCode NotAcceptable(406,
"Not Acceptable");
87 constexpr StatusCode ProxyAuthenticationRequired(407,
"Proxy Authentication Required");
88 constexpr StatusCode Conflict(409,
"Conflict");
89 constexpr StatusCode Gone(410,
"Gone");
90 constexpr StatusCode PayloadTooLarge(413,
"Payload Too Large");
91 constexpr StatusCode URITooLong(414,
"URI Too Long");
92 constexpr StatusCode UnsupportedMediaType(415,
"Unsupported Media Type");
93 constexpr StatusCode RangeNotSatisfiable(416,
"Range Not Satisfiable");
94 constexpr StatusCode ExpectationFailed(417,
"Expectation Failed");
95 constexpr StatusCode ImATeapot(418,
"I'm a teapot");
96 constexpr StatusCode PreconditionRequired(428,
"Precondition Required");
97 constexpr StatusCode TooManyRequests(429,
"Too Many Requests");
101 constexpr StatusCode NginxNoResponse(444,
"No Response");
102 constexpr StatusCode UnavailableForLegalReasons(451,
"Unavailable For Legal Reasons");
104 constexpr StatusCode InternalServerError(500,
"Internal Server Error");
105 constexpr StatusCode NotImplemented(501,
"Not Implemented");
106 constexpr StatusCode BadGateway(502,
"Bad Gateway");
107 constexpr StatusCode ServiceUnavailable(503,
"Service Unavailable");
108 constexpr StatusCode GatewayTimeout(504,
"Gateway Timeout");
109 constexpr StatusCode HttpVersionNotSupported(505,
"HTTP Version Not Supported");
110 constexpr StatusCode VariantAlsoNegotiates(506,
"Variant Also Negotiates");
Definition StatusCode.hpp:25
constexpr StatusCode(unsigned short statusCode, std::string_view statusLine)
Definition StatusCode.hpp:33