101 const std::string &
getBody()
const;
104 std::string _version;
202struct std::formatter<
dcn::http::Response> : std::formatter<std::string> {
204 return formatter<string>::format(
210struct std::formatter<
dcn::http::Request> : std::formatter<std::string> {
213 return formatter<string>::format(
MessageBase & addHeader(Header header, const std::string &value)
Adds a header to the message.
Definition http.cpp:28
MessageBase & operator=(const MessageBase &other)=delete
MessageBase & setHeader(Header header, const std::string &value)
Set a header in the message.
Definition http.cpp:34
const std::string & getVersion() const
Gets the version of the message.
Definition http.cpp:61
MessageBase()
Definition http.cpp:5
const HeadersList & getHeaders() const
Gets the headers of the message.
Definition http.cpp:66
virtual ~MessageBase()=default
const std::string & getBody() const
Gets the body of the message.
Definition http.cpp:71
MessageBase & setBody(const std::string &body)
Sets the body of the message.
Definition http.cpp:15
MessageBase(const MessageBase &other)=delete
MessageBase & setVersion(const std::string &version)
Sets the HTTP version of the message.
Definition http.cpp:9
MessageBase & setBodyWithContentLength(const std::string &body)
Sets the body of the message.
Definition http.cpp:21
std::vector< std::string > getHeader(Header header) const
Gets the value of a header.
Definition http.cpp:46
MessageBase & operator=(MessageBase &&other)=default
MessageBase(MessageBase &&other)=default
Request(Request &&other)=default
const Method & getMethod() const
Gets the HTTP method of the request.
Definition http.cpp:88
Request & operator=(Request &&other)=default
const URL & getPath() const
Gets the path of the request.
Definition http.cpp:93
Request(const Request &other)=delete
Request & operator=(const Request &other)=delete
Request & setMethod(const Method &method)
Sets the HTTP method of the request.
Definition http.cpp:76
Request & setPath(URL path)
Sets the path of the request.
Definition http.cpp:82
Response & setCode(Code code)
Sets the HTTP response code of the message.
Definition http.cpp:98
Response(Response &&other)=default
Response & operator=(const Response &other)=delete
const Code & getCode() const
Gets the HTTP response code of the message.
Definition http.cpp:104
Response & operator=(Response &&other)=default
Response(const Response &other)=delete
Method
Enum to represent the request method.
Definition http_method.hpp:31
Code
Enum to represent HTTP response status codes.
Definition http_codes.hpp:39
Header
Enum of HTTP headers as defined by the standard This enum contains the most commonly used HTTP header...
Definition http_headers.hpp:15
std::vector< std::pair< Header, std::string > > HeadersList
A list of headers A HeadersList is a vector of pairs, where the first element of the pair is a Header...
Definition http_headers.hpp:42
Definition decentralised_art.hpp:30