Support Class Library
A set of tools providing classes and utility
StatusCode.h
Go to the documentation of this file.
1 #pragma once
2 #include <string>
3 #include <scl/macros.h>
4 #include <scl/http/Version.h>
5 #include <scl/utils/Optional.h>
6 #include <scl/alias/aliases.h>
7 
8 namespace scl{
9  namespace http{
10  class StatusCode{
11  public:
16 
17  protected:
20  const message_type msg{};
22 
24  : shortInfo{name}, code{status}, msg{message}, vers{version} {
25  }
26 
27  public:
28  //friend class scl::utils::ToString<StatusCode>;
29 
30  constexpr name_type name() const{
31  return this->shortInfo;
32  }
33 
34  constexpr status_type status() const{
35  return this->code;
36  }
37 
38  constexpr message_type message() const{
39  return this->msg;
40  }
41 
42  constexpr version_type version() const{
43  return this->vers;
44  }
45 
46  public:
47  constexpr explicit operator status_type() const{
48  return this->code;
49  }
50 
51  constexpr bool operator==(const StatusCode& other) const{
52  return this->code == other.code;
53  }
54 
55  constexpr bool operator!=(const StatusCode& other) const{
56  return !(*this == other);
57  }
58 
63  constexpr bool isInformational() const{
64  return 100 <= static_cast<status_type>(*this)
65  && static_cast<status_type>(*this) < 200;
66  }
67 
72  constexpr bool isSuccessful() const{
73  return 200 <= static_cast<status_type>(*this)
74  && static_cast<status_type>(*this) < 300;
75  }
76 
81  constexpr bool isRedirect() const{
82  return 300 <= static_cast<status_type>(*this)
83  && static_cast<status_type>(*this) < 400;
84  }
85 
90  constexpr bool isClientError() const{
91  return 400 <= static_cast<status_type>(*this)
92  && static_cast<status_type>(*this) < 500;
93  }
94 
99  constexpr bool isServerError() const{
100  return 500 <= static_cast<status_type>(*this)
101  && static_cast<status_type>(*this) < 600;
102  }
103 
108  constexpr bool isOk() const{
109  return (this->isInformational() || this->isSuccessful() ||this->isRedirect())
110  && *this != SEE_OTHER //did not move
111  && *this != USE_PROXY //returns asking for proxy
112  /*&& *this != UNUSED //unused status code*/
113  && *this != TEMPORARY_REDIRECT; //did not move
114  }
115 
116  public:
117 #define CODE(name) static const StatusCode name
118  //1xy - Informational
119  CODE(CONTINUE); //RFC 7231 6.2.1
120  CODE(SWITCHING_PROTOCOLS); //RFC 7231 6.2.2
121  CODE(PROCESSING); //RFC 2518 10.1
122  CODE(EARLY_HINTS); //RFC 8297 2
123 
124  //2xy - Successful
125  CODE(OK); //RFC 7231 6.3.1
126  CODE(CREATED); //RFC 7231 6.3.2
127  CODE(ACCEPTED); //RFC 7231 6.3.3
129  CODE(NO_CONTENT); //RFC 7231 6.3.5
130  CODE(RESET_CONTENT); //RFC 7231 6.3.6
131  CODE(PARTIAL_CONTENT); //RFC 7233 4.1
132  CODE(MULTI_STATUS); //RFC 4918 11.1
133  CODE(ALREADY_REPORTED); //RFC 5842 7.1
134  CODE(IM_USED); //RFC 3229 10.4.1
135 
136  //3xy - Redirections
137  CODE(MULTIPLE_CHOICES); //RFC 7231 6.4.1
138  CODE(MOVED_PERMANENTLY); //RFC 7231 6.4.2
139  CODE(FOUND); //RFC 7231 6.4.3
140  CODE(SEE_OTHER); //RFC 7231 6.4.4
141  CODE(NOT_MODIFIED); //RFC 7232 4.1
142  /*CODE(UNUSED);*/
143  CODE(USE_PROXY); //RFC 7231 6.4.5
144  CODE(TEMPORARY_REDIRECT); //RFC 7231 6.4.7
145  CODE(PERMANENT_REDIRECT); //RFC 7238 3
146 
147  //4xy - Client Error
148  CODE(BAD_REQUEST); //RFC 7231 6.5.1
149  CODE(UNAUTHORIZED); //RFC 7235 3.1
150  CODE(PAYMENT_REQUIRED); //RFC 7231 6.5.2
151  CODE(FORBIDDEN); //RFC 7231 6.5.3
152  CODE(NOT_FOUND); //RFC 7231 6.5.4
153  CODE(METHOD_NOT_ALLOWED); //RFC 7231 6.5.5
154  CODE(NOT_ACCEPTABLE); //RFC 7231 6.5.6
156  CODE(REQUEST_TIMEOUT); //RFC 7231 6.5.7
157  CODE(CONFLICT); //RFC 7231 6.5.8
158  CODE(GONE); //RFC 7231 6.5.9
159  CODE(LENGTH_REQUIRED); //RFC 7231 6.5.10
160  CODE(PRECONDITION_FAILED); //RFC 7232 4.2
161  CODE(REQUEST_ENTITY_TOO_LARGE); //RFC 7231 6.5.11 //TODO: Change name
162  CODE(REQUEST_URI_TOO_LONG); //RFC 7231 6.5.12 //TODO: Change name
163  CODE(UNSUPPORTED_MEDIA_TYPE); //RFC 7231 6.5.13
165  CODE(EXPECTATION_FAILED); //RFC 7231 6.5.14
166  CODE(TEAPOT); //RFC 7168 2.3.3
167  CODE(MISDIRECTED_REQUEST); // RFC 7540 9.1.2
168  CODE(UNPROCESSABLE_ENTITY); //RFC 4918 11.2
169  CODE(LOCKED); //RFC 4918 11.3
170  CODE(FAILED_DEPENDENCY); //RFC 4918 11.4
171  CODE(TOO_EARLY); //RFC 8470 5.2 //TODO: add to node/deno
172  CODE(UPGRADE_REQUIRED); //RFC 7231 6.5.15
174  CODE(TOO_MANY_REQUESTS); //RFC 6585 4
177 
178  //5xy - Server Error
179  CODE(INTERNAL_SERVER_ERROR); //RFC 7231 6.6.1
180  CODE(NOT_IMPLEMENTED); //RFC 7231 6.6.2
181  CODE(BAD_GATEWAY); //RFC 7231 6.6.3
182  CODE(SERVICE_UNAVAILABLE); //RFC 7231 6.6.4
183  CODE(GATEWAY_TIMEOUT); //RFC 7231 6.6.5
184  CODE(HTTP_VERSION_NOT_SUPPORTED); //RFC 7231 6.6.6
185  CODE(VARIANT_ALSO_NEGOTIATES); //RFC 2295 8.1
186  CODE(INSUFFICIENT_STORAGE); //RFC 4918 11.5
187  CODE(LOOP_DETECTED); //RFC 5842 7.2
189  CODE(NOT_EXTENDED); //RFC 2774 7
191 #undef CODE
192 
193  public:
202  /*if(
203  status < 100
204  || (103 < status && status < 200)
205  || (226 < status && status < 300)
206  || (308 < status && status < 400)
207  || (451 < status && status < 500)
208  || 511 < status
209  )//if invalid status
210  return scl::utils::none;*/
211 
212  switch(status){
213  case 100: return CONTINUE;
214  case 101: return SWITCHING_PROTOCOLS;
215  case 102: return PROCESSING;
216  case 103: return EARLY_HINTS;
217 
218  case 200: return OK;
219  case 201: return CREATED;
220  case 202: return ACCEPTED;
221  case 203: return NON_AUTHORITATIVE_INFORMATION;
222  case 204: return NO_CONTENT;
223  case 205: return RESET_CONTENT;
224  case 206: return PARTIAL_CONTENT;
225  case 207: return MULTI_STATUS;
226  case 208: return ALREADY_REPORTED;
227  case 226: return IM_USED;
228 
229  case 300: return MULTIPLE_CHOICES;
230  case 301: return MOVED_PERMANENTLY;
231  case 302: return FOUND;
232  case 303: return SEE_OTHER;
233  case 304: return NOT_MODIFIED;
234  case 305: return USE_PROXY;
235  case 307: return TEMPORARY_REDIRECT;
236  case 308: return PERMANENT_REDIRECT;
237 
238  case 400: return BAD_REQUEST;
239  case 401: return UNAUTHORIZED;
240  case 402: return PAYMENT_REQUIRED; //only reserved but make it available
241  case 403: return FORBIDDEN;
242  case 404: return NOT_FOUND;
243  case 405: return METHOD_NOT_ALLOWED;
244  case 406: return NOT_ACCEPTABLE;
245  case 407: return PROXY_AUTHENTICATION_REQUIRED;
246  case 408: return REQUEST_TIMEOUT;
247  case 409: return CONFLICT;
248  case 410: return GONE;
249  case 411: return LENGTH_REQUIRED;
250  case 412: return PRECONDITION_FAILED;
251  case 413: return REQUEST_ENTITY_TOO_LARGE;
252  case 414: return REQUEST_URI_TOO_LONG;
253  case 415: return UNSUPPORTED_MEDIA_TYPE;
254  case 416: return REQUESTED_RANGE_NOT_SATISFIABLE;
255  case 417: return EXPECTATION_FAILED;
256  case 418: return TEAPOT;
257  case 421: return MISDIRECTED_REQUEST;
258  case 422: return UNPROCESSABLE_ENTITY;
259  case 423: return LOCKED;
260  case 424: return FAILED_DEPENDENCY;
261  case 425: return TOO_EARLY;
262  case 426: return UPGRADE_REQUIRED;
263  case 428: return PRECONDITION_REQUIRED;
264  case 429: return TOO_MANY_REQUESTS;
265  case 431: return REQUEST_HEADER_FIELDS_TOO_LARGE;
266  case 451: return UNAVAILABLE_FOR_LEGAL_REASONS;
267 
268  case 500: return INTERNAL_SERVER_ERROR;
269  case 501: return NOT_IMPLEMENTED;
270  case 502: return BAD_GATEWAY;
271  case 503: return SERVICE_UNAVAILABLE;
272  case 504: return GATEWAY_TIMEOUT;
273  case 505: return HTTP_VERSION_NOT_SUPPORTED;
274  case 506: return VARIANT_ALSO_NEGOTIATES;
275  case 507: return INSUFFICIENT_STORAGE;
276  case 508: return LOOP_DETECTED;
277  case 509: return BANDWIDTH_LIMIT_EXCEEDED;
278  case 510: return NOT_EXTENDED;
279  case 511: return NETWORK_AUTHENTICATION_REQUIRED;
280 
281  default: return scl::utils::none;
282  }
283  };
284  };
285 
286 #define DEF_CODE(name, shortInfo, code, msg) \
287  \
293  const StatusCode StatusCode::name{shortInfo, code, msg};
294 
295  //1xy
296  DEF_CODE(CONTINUE, "Continue", 100, "Continue with the request");
297  DEF_CODE(SWITCHING_PROTOCOLS, "Switching Protocols", 101, "Switching protocols");
298  DEF_CODE(PROCESSING, "Processing", 102, "The server has accepted the request but has not yet completed it");
299  DEF_CODE(EARLY_HINTS, "Early Hints", 103, "The server is likely to send a final response with the header fields included in the informational response");
300 
301  //2xy
302  DEF_CODE(OK, "Ok", 200, "Request fulfilled");
303  DEF_CODE(CREATED, "Created", 201, "Resource has been created");
304  DEF_CODE(ACCEPTED, "Accepted", 202, "Request accepted for processing");
305  DEF_CODE(NON_AUTHORITATIVE_INFORMATION, "Non-Authoritative Information", 203, "Request fulfilled but has been modified");
306  DEF_CODE(NO_CONTENT, "No Content", 204, "Request fulfilled, no entity-body returned");
307  DEF_CODE(RESET_CONTENT, "Reset Content", 205, "Request fulfilled, user agent should reset the document view");
308  DEF_CODE(PARTIAL_CONTENT, "Partial Content", 206, "Partial GET request fulfilled");
309  DEF_CODE(MULTI_STATUS, "Multi Status", 207, "Statuses for multiple operations");
310  DEF_CODE(ALREADY_REPORTED, "Already reported", 208, "One of the requested resources has already been reported");
311  DEF_CODE(IM_USED, "IM Used", 226, "The server has fulfilled a GET request for the resource, and the response is a representation of the result of one or more instance-manipulation applied to the current instance");
312 
313  //3xy
314  DEF_CODE(MULTIPLE_CHOICES, "Multiple Choices", 300, "The requested resource corresponds to any one of a set of representations");
315  DEF_CODE(MOVED_PERMANENTLY, "Moved Permanently", 301, "The requested resource has been assigned a new permanent URI");
316  DEF_CODE(FOUND, "Found", 302, "The requested resource has been delivered but resides temporarily under a different URI");
317  DEF_CODE(SEE_OTHER, "See Other", 303, "The requested resource can be found under a different URI");
318  DEF_CODE(NOT_MODIFIED, "Not Modified", 304, "Document has not been modified");
319  DEF_CODE(USE_PROXY, "Use Proxy", 305, "The requested resource must be accessed through the given proxy");
320  /*DEF_CODE(UNUSED, "[[Unused]]", 306, "[[Was used in previous version of the specification, no longer used, reserved]]");*/
321  DEF_CODE(TEMPORARY_REDIRECT, "Temporary Redirect", 307, "The requested resource resides temporarily under a different URI");
322  DEF_CODE(PERMANENT_REDIRECT, "Permanent Redirect", 308, "The requested resource resides permanently under a different URI");
323 
324  //4xy
325  DEF_CODE(BAD_REQUEST, "Bad Request", 400, "Request could not be understood due to malformed syntax");
326  DEF_CODE(UNAUTHORIZED, "Unauthorized", 401, "Request requires user authentication");
327  DEF_CODE(PAYMENT_REQUIRED, "Payment Required", 402, "[[This code is reserved for future use]]");
328  DEF_CODE(FORBIDDEN, "Forbidden", 403, "Request understood but the server refuses to fulfill it");
329  DEF_CODE(NOT_FOUND, "Not Found", 404, "The requested resource has not been found");
330  DEF_CODE(METHOD_NOT_ALLOWED, "Method Not Allowed", 405, "The specified method is not allowed for the identified resource");
331  DEF_CODE(NOT_ACCEPTABLE, "Not Acceptable", 406, "Responses would not be acceptable according to accept headers in the request");
332  DEF_CODE(PROXY_AUTHENTICATION_REQUIRED, "Proxy Authentication Required", 407, "Client must first authenticate itself with the proxy");
333  DEF_CODE(REQUEST_TIMEOUT, "Request Timeout", 408, "Client did not produce a request within the time the server was prepared to wait");
334  DEF_CODE(CONFLICT, "Conflict", 409, "Request could not be completed due to a conflict with the current state of the resource");
335  DEF_CODE(GONE, "Gone", 410, "The requested resource is no longer available");
336  DEF_CODE(LENGTH_REQUIRED, "Length Required", 411, "Content-Length header missing");
337  DEF_CODE(PRECONDITION_FAILED, "Precondition Failed", 412, "Precondition given in one or more request-header fields evaluated to false");
338  DEF_CODE(REQUEST_ENTITY_TOO_LARGE, "Request Entity Too Large", 413, "Provided request entity is larger than the server is willing/able to process");
339  DEF_CODE(REQUEST_URI_TOO_LONG, "Request-URI Too Long", 414, "Request-URI is longer than the server is willing to process");
340  DEF_CODE(UNSUPPORTED_MEDIA_TYPE, "Unsupported Media Type", 415, "The format of the entity of the request is not supported");
341  DEF_CODE(REQUESTED_RANGE_NOT_SATISFIABLE, "Requested Range Not Satisfiable", 416, "Request Range could not be satisfied");
342  DEF_CODE(EXPECTATION_FAILED, "Expectation Failed", 417, "Request Expect could not be met");
343  DEF_CODE(TEAPOT, "I'm a teapot", 418, "I'm a teapot");
344  DEF_CODE(MISDIRECTED_REQUEST, "Misdirected Request", 421, "Request was directed at a server that is not able to produce a response");
345  DEF_CODE(UNPROCESSABLE_ENTITY, "Unprocessable Entity", 422, "The server understands the content type and the syntax is correct but was unable to process the contained instructions");
346  DEF_CODE(LOCKED, "Locked", 423, "The requested resource is locked");
347  DEF_CODE(FAILED_DEPENDENCY, "Failed Dependency", 424, "The server could not process the requested action because it depends on an action that failed");
348  DEF_CODE(TOO_EARLY, "Too Early", 425, "The server is unwilling to risk processing a request that might be replayed");
349  DEF_CODE(UPGRADE_REQUIRED, "Upgrade Required", 426, "The server refuses to perform the request using the current protocol but might if the client upgrades to a different protocol");
350  DEF_CODE(PRECONDITION_REQUIRED, "Precondition Required", 428, "The server requires the request to be conditional (missing If-Match header)");
351  DEF_CODE(TOO_MANY_REQUESTS, "Too Many Requests", 429, "The user has sent too many requests in a given amount of time");
352  DEF_CODE(REQUEST_HEADER_FIELDS_TOO_LARGE, "Request Header Fields Too Large", 431, "The server is unwilling to process the request because its header fields are too large");
353  DEF_CODE(UNAVAILABLE_FOR_LEGAL_REASONS, "Unavailable For Legal Reasons", 451, "The requested resource is unavailable for legal reasons");
354 
355  //5xy
356  DEF_CODE(INTERNAL_SERVER_ERROR, "Internal Server Error", 500, "Unexpected server error");
357  DEF_CODE(NOT_IMPLEMENTED, "Not Implemented", 501, "The server does not support the functionality required to fulfill the request");
358  DEF_CODE(BAD_GATEWAY, "Bad Gateway", 502, "The server, acting as a gateway/proxy, received an invalid response from the upstream server it accessed in attempting to fulfill the request");
359  DEF_CODE(SERVICE_UNAVAILABLE, "Service Unavailable", 503, "The server is currently unable to handle the request due to a temporary overloading or maintenance");
360  DEF_CODE(GATEWAY_TIMEOUT, "Gateway Timeout", 504, "The server, acting as a gateway/proxy, did not receive a timely response from the upstream server it accessed in attempting to fulfill the request");
361  DEF_CODE(HTTP_VERSION_NOT_SUPPORTED, "HTTP Version Not Supported", 505, "The server does not support, or refuses to support, the HTTP protocol version that was used in the request");
362  DEF_CODE(VARIANT_ALSO_NEGOTIATES, "Variant Also Negotiates", 506, "The chosen variant resource is configured to engage in transparent content negotiation and is therefore not a proper end point in the negotiation process");
363  DEF_CODE(INSUFFICIENT_STORAGE, "Insufficient Storage", 507, "The server was unable to process the request because it could not store the representation needed to successfully complete the request");
364  DEF_CODE(LOOP_DETECTED, "Loop Detected", 508, "The server terminated an operation because it encountered an infinite loop while processing a request");
365  DEF_CODE(BANDWIDTH_LIMIT_EXCEEDED, "Loop Detected", 509, "The amount of bandwidth allocated has been reached");
366  DEF_CODE(NOT_EXTENDED, "Not Extended", 510, "The policy for accessing the resource has not been met in the request");
367  DEF_CODE(NETWORK_AUTHENTICATION_REQUIRED, "Network Authentication Required", 511, "The client needs to authenticate to gain network access");
368 #undef DEF_CODE
369  }
370 
371  namespace utils{
372  template <>
374  static const std::string STATUS, SEP, CF, SPECS;
376  return STATUS + std::to_string(status.status())
377  + SEP + status.name()
378  + CF + std::to_string(status.version()) + SPECS;
379  }
380  };
381 
382  const std::string ToString<scl::http::StatusCode>::STATUS = "Status ";
383  const std::string ToString<scl::http::StatusCode>::SEP = ": ";
384  const std::string ToString<scl::http::StatusCode>::CF = " (cf. ";
385  const std::string ToString<scl::http::StatusCode>::SPECS = " specifications)";
386  }
387 }
static const StatusCode NETWORK_AUTHENTICATION_REQUIRED
Definition: StatusCode.h:190
static const StatusCode CREATED
Definition: StatusCode.h:126
static const StatusCode GATEWAY_TIMEOUT
Definition: StatusCode.h:183
static const StatusCode NON_AUTHORITATIVE_INFORMATION
Definition: StatusCode.h:128
static const StatusCode REQUESTED_RANGE_NOT_SATISFIABLE
Definition: StatusCode.h:164
constexpr name_type name() const
Definition: StatusCode.h:30
static const StatusCode PRECONDITION_REQUIRED
Definition: StatusCode.h:173
static const StatusCode UNSUPPORTED_MEDIA_TYPE
Definition: StatusCode.h:163
static const StatusCode HTTP_VERSION_NOT_SUPPORTED
Definition: StatusCode.h:184
constexpr bool operator==(const StatusCode &other) const
Definition: StatusCode.h:51
static const StatusCode PERMANENT_REDIRECT
Definition: StatusCode.h:145
static const StatusCode IM_USED
Definition: StatusCode.h:134
static const StatusCode SEE_OTHER
Definition: StatusCode.h:140
const version_type & vers
Definition: StatusCode.h:21
constexpr bool isOk() const
Determine whether or not this status code indicates that the requests was fulfilled.
Definition: StatusCode.h:108
static const StatusCode PAYMENT_REQUIRED
Definition: StatusCode.h:150
static const StatusCode INSUFFICIENT_STORAGE
Definition: StatusCode.h:186
A pseudo enum class that describes the version of the HTTP Protocol.
Definition: Version.h:10
Global namespace of the SCL.
Definition: alias.hpp:3
constexpr bool isInformational() const
Determine whether or not this status code is informational.
Definition: StatusCode.h:63
constexpr status_type status() const
Definition: StatusCode.h:34
#define DEF_CODE(name, shortInfo, code, msg)
Definition: StatusCode.h:286
static const StatusCode SERVICE_UNAVAILABLE
Definition: StatusCode.h:182
static const StatusCode OK
Definition: StatusCode.h:125
static const StatusCode MULTI_STATUS
Definition: StatusCode.h:132
static const StatusCode REQUEST_HEADER_FIELDS_TOO_LARGE
Definition: StatusCode.h:175
static const StatusCode NOT_FOUND
Definition: StatusCode.h:152
static const StatusCode BANDWIDTH_LIMIT_EXCEEDED
Definition: StatusCode.h:188
static const StatusCode INTERNAL_SERVER_ERROR
Definition: StatusCode.h:179
static const StatusCode REQUEST_TIMEOUT
Definition: StatusCode.h:156
static const Version V1_1
Definition: Version.h:91
static const StatusCode PRECONDITION_FAILED
Definition: StatusCode.h:160
static const StatusCode UNPROCESSABLE_ENTITY
Definition: StatusCode.h:168
static const StatusCode FORBIDDEN
Definition: StatusCode.h:151
static const StatusCode PROCESSING
Definition: StatusCode.h:121
static const StatusCode FAILED_DEPENDENCY
Definition: StatusCode.h:170
static const StatusCode PARTIAL_CONTENT
Definition: StatusCode.h:131
static const StatusCode UPGRADE_REQUIRED
Definition: StatusCode.h:172
static const StatusCode TEMPORARY_REDIRECT
Definition: StatusCode.h:144
static const StatusCode TOO_EARLY
Definition: StatusCode.h:171
static const StatusCode VARIANT_ALSO_NEGOTIATES
Definition: StatusCode.h:185
static const StatusCode MULTIPLE_CHOICES
Definition: StatusCode.h:137
static const StatusCode NOT_MODIFIED
Definition: StatusCode.h:141
const char * name_type
Definition: StatusCode.h:12
static const StatusCode LENGTH_REQUIRED
Definition: StatusCode.h:159
static const StatusCode PROXY_AUTHENTICATION_REQUIRED
Definition: StatusCode.h:155
static const StatusCode MOVED_PERMANENTLY
Definition: StatusCode.h:138
const message_type msg
Definition: StatusCode.h:20
static const StatusCode UNAUTHORIZED
Definition: StatusCode.h:149
constexpr bool isSuccessful() const
Determine whether or not this status code is for a successful request.
Definition: StatusCode.h:72
A class that allows the use of optional types (might be there)
Definition: Optional.h:65
static const StatusCode METHOD_NOT_ALLOWED
Definition: StatusCode.h:153
constexpr version_type version() const
Definition: StatusCode.h:42
constexpr None none
A constant global variable of type None.
Definition: Optional.h:41
static const StatusCode EARLY_HINTS
Definition: StatusCode.h:122
static const StatusCode NOT_ACCEPTABLE
Definition: StatusCode.h:154
#define CODE(name)
Definition: StatusCode.h:117
const status_type code
Definition: StatusCode.h:19
constexpr bool isRedirect() const
Determine whether or not this status code is one of a redirection.
Definition: StatusCode.h:81
static const StatusCode UNAVAILABLE_FOR_LEGAL_REASONS
Definition: StatusCode.h:176
constexpr bool isServerError() const
Determine whether or not this status code is one of a server error.
Definition: StatusCode.h:99
static const StatusCode LOOP_DETECTED
Definition: StatusCode.h:187
static const StatusCode GONE
Definition: StatusCode.h:158
static const StatusCode NOT_IMPLEMENTED
Definition: StatusCode.h:180
static const StatusCode REQUEST_URI_TOO_LONG
Definition: StatusCode.h:162
static const StatusCode SWITCHING_PROTOCOLS
Definition: StatusCode.h:120
constexpr bool operator!=(const StatusCode &other) const
Definition: StatusCode.h:55
static const StatusCode REQUEST_ENTITY_TOO_LARGE
Definition: StatusCode.h:161
static const StatusCode FOUND
Definition: StatusCode.h:139
static scl::utils::Optional< StatusCode > fromCode(const status_type &status)
Get an optional StatusCode from the status code.
Definition: StatusCode.h:201
static const StatusCode BAD_REQUEST
Definition: StatusCode.h:148
std::string operator()(const scl::http::StatusCode &status)
Definition: StatusCode.h:375
static const StatusCode EXPECTATION_FAILED
Definition: StatusCode.h:165
static const StatusCode TOO_MANY_REQUESTS
Definition: StatusCode.h:174
constexpr bool isClientError() const
Determine whether or not this status code is one of a client error.
Definition: StatusCode.h:90
static const StatusCode ACCEPTED
Definition: StatusCode.h:127
unsigned int uint
Unsigned integer.
Definition: aliases.h:55
static const StatusCode BAD_GATEWAY
Definition: StatusCode.h:181
static const StatusCode MISDIRECTED_REQUEST
Definition: StatusCode.h:167
const name_type shortInfo
Definition: StatusCode.h:18
scl::alias::uint status_type
Definition: StatusCode.h:13
constexpr StatusCode(name_type name, status_type status, message_type message, const version_type &version=Version::V1_1)
Definition: StatusCode.h:23
static const StatusCode TEAPOT
Definition: StatusCode.h:166
constexpr message_type message() const
Definition: StatusCode.h:38
const char * message_type
Definition: StatusCode.h:14
static const StatusCode USE_PROXY
Definition: StatusCode.h:143
#define stringLiteral
Definition: macros.h:4
static const StatusCode LOCKED
Definition: StatusCode.h:169
static const StatusCode RESET_CONTENT
Definition: StatusCode.h:130
static const StatusCode NO_CONTENT
Definition: StatusCode.h:129
static const StatusCode ALREADY_REPORTED
Definition: StatusCode.h:133
static const StatusCode NOT_EXTENDED
Definition: StatusCode.h:189
static const StatusCode CONTINUE
Definition: StatusCode.h:119
static const StatusCode CONFLICT
Definition: StatusCode.h:157