A type for representation of HTTP method ID.
RESTinio uses http_parser for working with HTTP-protocol. HTTP-methods in http_parser are identified by int
s like HTTP_GET, HTTP_POST and so on.
Usage of plain int
is error prone. So since v.0.5.0 RESTinio contain type http_method_id_t as type for ID of HTTP method.
An instance of http_method_id_t contains two values:
- integer identifier from http_parser (like HTTP_GET, HTTP_POST and so on);
- a string representation of HTTP method ID (like "GET", "POST", "DELETE" and so on).
There is an important requirement for user-defined HTTP method IDs: a pointer to string representation of HTTP method ID must outlive the instance of http_method_id_t. It means that is safe to use string literals or static strings, for example:
A type for representation of HTTP method ID.
run_on_this_thread_settings_t< Traits > on_this_thread()
A special marker for the case when http_server must be run on the context of the current thread.
- Note
- Instances of http_method_id_t can't be used in switch() operator. For example, you can't write that way: In that case raw_id() method can be used:
- Since
- v.0.5.0
Definition at line 1745 of file http_headers.hpp.