Sourcemeta Core 0.0.0
Loading...
Searching...
No Matches
http_method.h
1#ifndef SOURCEMETA_CORE_HTTP_METHOD_H_
2#define SOURCEMETA_CORE_HTTP_METHOD_H_
3
4#include <cstdint> // std::uint8_t
5#include <string_view> // std::string_view
6#include <utility> // std::unreachable
7
8namespace sourcemeta::core {
9
32
44inline constexpr auto http_method_string(const HTTPMethod method) noexcept
45 -> std::string_view {
46 switch (method) {
47 case HTTPMethod::GET:
48 return "GET";
50 return "HEAD";
52 return "POST";
53 case HTTPMethod::PUT:
54 return "PUT";
56 return "DELETE";
58 return "CONNECT";
60 return "OPTIONS";
62 return "TRACE";
64 return "PATCH";
65 }
66
67 std::unreachable();
68}
69
70} // namespace sourcemeta::core
71
72#endif
HTTPMethod
Definition http_method.h:12
constexpr auto http_method_string(const HTTPMethod method) noexcept -> std::string_view
Definition http_method.h:44
@ OPTIONS
Describe the communication options available for the target resource.
Definition http_method.h:26
@ TRACE
Perform a message loop-back test along the path to the target resource.
Definition http_method.h:28
@ DELETE
Remove the association between the target resource and its function.
Definition http_method.h:22
@ PUT
Replace the target resource with the enclosed representation.
Definition http_method.h:20
@ PATCH
Apply a partial modification to the target resource per RFC 5789 ยง2.
Definition http_method.h:30
@ GET
Transfer a current representation of the target resource.
Definition http_method.h:14
@ POST
Process the enclosed representation according to the resource semantics.
Definition http_method.h:18
@ CONNECT
Establish a tunnel to the server identified by the target resource.
Definition http_method.h:24
@ HEAD
Identical to a retrieval but without transferring the response content.
Definition http_method.h:16