Decentralised Art Server
High-performance C++ backend that exposes HTML interface and a secure REST API for managing Performative Transactions entities
Loading...
Searching...
No Matches
http_method.hpp
Go to the documentation of this file.
1
#pragma once
2
3
#include <format>
4
#include <string>
5
6
namespace
dcn::http
7
{
30
enum class
Method
31
{
32
//Unknown, specially reserved
33
Unknown
= 0,
34
35
GET
,
36
HEAD
,
37
PUT
,
38
DEL
,
//DELETE collides with macro definition in winnt.h ...
39
POST
,
40
OPTIONS
41
};
42
}
43
44
namespace
dcn::parse
45
{
53
http::Method
parseMethodFromString
(
const
std::string &
method
);
54
}
55
56
template
<>
57
struct
std::formatter<
dcn
::http::Method> : std::formatter<std::string> {
58
59
auto
format
(
dcn::http::Method
method, format_context& ctx)
const
{
60
switch
(method)
61
{
62
case
dcn::http::Method::GET
:
return
formatter<string>::format(
"GET"
, ctx);
63
case
dcn::http::Method::HEAD
:
return
formatter<string>::format(
"HEAD"
, ctx);
64
case
dcn::http::Method::PUT
:
return
formatter<string>::format(
"PUT"
, ctx);
65
case
dcn::http::Method::DEL
:
return
formatter<string>::format(
"DELETE"
, ctx);
66
case
dcn::http::Method::POST
:
return
formatter<string>::format(
"POST"
, ctx);
67
case
dcn::http::Method::OPTIONS
:
return
formatter<string>::format(
"OPTIONS"
, ctx);
68
69
// Unknown
70
case
dcn::http::Method::Unknown
:
return
formatter<string>::format(
"Unknown"
, ctx);
71
}
72
return
formatter<string>::format(
""
, ctx);
73
}
74
};
dcn::http
Definition
http.hpp:16
dcn::http::Method
Method
Enum to represent the request method.
Definition
http_method.hpp:31
dcn::http::Method::OPTIONS
@ OPTIONS
dcn::http::Method::DEL
@ DEL
dcn::http::Method::PUT
@ PUT
dcn::http::Method::GET
@ GET
dcn::http::Method::Unknown
@ Unknown
dcn::http::Method::POST
@ POST
dcn::http::Method::HEAD
@ HEAD
dcn::http::Code::Unknown
@ Unknown
dcn::parse
Definition
auth.hpp:34
dcn::parse::parseMethodFromString
http::Method parseMethodFromString(const std::string &method)
Parse the given string to a http::Method.
Definition
http_method.cpp:5
dcn
Definition
decentralised_art.hpp:30
dcn::RouteArgRequirement::optional
@ optional
std::formatter< dcn::http::Method >::format
auto format(dcn::http::Method method, format_context &ctx) const
Definition
http_method.hpp:59
src
http
include
http_method.hpp
Generated by
1.9.8