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
dcn::http::MessageBase Class Reference

#include <http.hpp>

Inheritance diagram for dcn::http::MessageBase:
dcn::http::Request dcn::http::Response

Public Member Functions

 MessageBase ()
 
 MessageBase (MessageBase &&other)=default
 
MessageBaseoperator= (MessageBase &&other)=default
 
 MessageBase (const MessageBase &other)=delete
 
MessageBaseoperator= (const MessageBase &other)=delete
 
virtual ~MessageBase ()=default
 
MessageBasesetVersion (const std::string &version)
 Sets the HTTP version of the message.
 
MessageBasesetBody (const std::string &body)
 Sets the body of the message.
 
MessageBasesetBodyWithContentLength (const std::string &body)
 Sets the body of the message.
 
MessageBaseaddHeader (Header header, const std::string &value)
 Adds a header to the message.
 
MessageBasesetHeader (Header header, const std::string &value)
 Set a header in the message.
 
std::vector< std::string > getHeader (Header header) const
 Gets the value of a header.
 
const std::string & getVersion () const
 Gets the version of the message.
 
const HeadersListgetHeaders () const
 Gets the headers of the message.
 
const std::string & getBody () const
 Gets the body of the message.
 

Constructor & Destructor Documentation

◆ MessageBase() [1/3]

dcn::http::MessageBase::MessageBase ( )

◆ MessageBase() [2/3]

dcn::http::MessageBase::MessageBase ( MessageBase &&  other)
default

◆ MessageBase() [3/3]

dcn::http::MessageBase::MessageBase ( const MessageBase other)
delete

◆ ~MessageBase()

virtual dcn::http::MessageBase::~MessageBase ( )
virtualdefault

Member Function Documentation

◆ addHeader()

MessageBase & dcn::http::MessageBase::addHeader ( Header  header,
const std::string &  value 
)

Adds a header to the message.

If the header does not exist, it is added. Even If the header of the same key already exists.

Parameters
[in]headerThe header to add.
[in]valueThe value of the header.

◆ getBody()

const std::string & dcn::http::MessageBase::getBody ( ) const

Gets the body of the message.

Returns
The body of the message.

◆ getHeader()

std::vector< std::string > dcn::http::MessageBase::getHeader ( Header  header) const

Gets the value of a header.

Parameters
[in]headerThe header to get the value of.
Returns
The value of the header.

◆ getHeaders()

const HeadersList & dcn::http::MessageBase::getHeaders ( ) const

Gets the headers of the message.

Returns
The headers of the message.

◆ getVersion()

const std::string & dcn::http::MessageBase::getVersion ( ) const

Gets the version of the message.

Returns
The version of the message.

◆ operator=() [1/2]

MessageBase & dcn::http::MessageBase::operator= ( const MessageBase other)
delete

◆ operator=() [2/2]

MessageBase & dcn::http::MessageBase::operator= ( MessageBase &&  other)
default

◆ setBody()

MessageBase & dcn::http::MessageBase::setBody ( const std::string &  body)

Sets the body of the message.

This function sets the body of the message to the provided string and updates the Content-Length header to reflect the size of the new body.

Parameters
[in]bodyThe body content to set.

◆ setBodyWithContentLength()

MessageBase & dcn::http::MessageBase::setBodyWithContentLength ( const std::string &  body)

Sets the body of the message.

This function sets the body of the message to the provided string and updates the Content-Length header to reflect the size of the new body.

Parameters
[in]bodyThe body content to set.

◆ setHeader()

MessageBase & dcn::http::MessageBase::setHeader ( Header  header,
const std::string &  value 
)

Set a header in the message.

Parameters
[in]headerThe header to set.
[in]valueThe value of the header.

If the header does not exist, it is added. If the header already exists, its value is replaced.

◆ setVersion()

MessageBase & dcn::http::MessageBase::setVersion ( const std::string &  version)

Sets the HTTP version of the message.

Parameters
[in]versionThe version to set.

The documentation for this class was generated from the following files: