Sese Framework  2.3.0
A cross-platform framework
Loading...
Searching...
No Matches
sese::net::http::RequestHeader Class Reference

Request Header Class. More...

#include <RequestHeader.h>

Inheritance diagram for sese::net::http::RequestHeader:
sese::net::http::Header sese::net::http::Request

Public Types

using Ptr = std::unique_ptr<RequestHeader>
 
- Public Types inherited from sese::net::http::Header
using Ptr = std::unique_ptr<Header>
 
using KeyValueType = std::pair<std::string, std::string>
 

Public Member Functions

 RequestHeader ()=default
 
 RequestHeader (const std::initializer_list< KeyValueType > &initializer_list)
 
RequestType getType () const
 
void setType (RequestType request_type)
 
const std::string & getUri () const
 
void setUri (const std::string &uri)
 
const std::string & getQueryArg (const std::string &key, const std::string &default_value) const
 
void setQueryArg (const std::string &key, const std::string &value)
 
size_t queryArgsSize () const
 
bool queryArgsEmpty () const
 
void queryArgsClear ()
 
bool queryArgsExist (const std::string &key)
 
const std::string & getQueryArg (const std::string &key)
 
HttpVersion getVersion () const
 
void setVersion (HttpVersion new_version)
 
std::string getUrl () const
 
void setUrl (const std::string &request_url)
 
- Public Member Functions inherited from sese::net::http::Header
 Header ()=default
 
 Header (const std::initializer_list< KeyValueType > &initializer_list) noexcept
 
virtual ~Header ()=default
 
void set (const std::string &key, const std::string &value) noexcept
 
const std::string & get (const std::string &key, const std::string &default_value) noexcept
 
std::map< std::string, std::string >::iterator begin () noexcept
 
std::map< std::string, std::string >::iterator end () noexcept
 
auto find (const std::string &key) noexcept
 
void clear ()
 
bool empty () const
 
size_t size () const
 
bool exist (const std::string &key)
 
const std::string & get (const std::string &key)
 
const CookieMap::PtrgetCookies () const
 
void setCookies (const CookieMap::Ptr &cookies)
 
Cookie::Ptr getCookie (const std::string &name) const
 
void setCookie (const Cookie::Ptr &cookie)
 

Protected Attributes

RequestType type = RequestType::GET
 
std::string uri = "/"
 
HttpVersion version = HttpVersion::VERSION_1_1
 
std::map< std::string, std::string > query_args
 
- Protected Attributes inherited from sese::net::http::Header
StrCaseMap< std::string > headers
 
CookieMap::Ptr cookies = nullptr
 

Detailed Description

Request Header Class.

Warning
The uri field is not processed (URL + QueryString)

Member Typedef Documentation

◆ Ptr

Constructor & Destructor Documentation

◆ RequestHeader() [1/2]

sese::net::http::RequestHeader::RequestHeader ( )
default

◆ RequestHeader() [2/2]

sese::net::http::RequestHeader::RequestHeader ( const std::initializer_list< KeyValueType > & initializer_list)
inline

Member Function Documentation

◆ getQueryArg() [1/2]

const std::string & sese::net::http::RequestHeader::getQueryArg ( const std::string & key)
inline

Call this when certain the field exists

See also
sese::net::http::RequestHeader::queryArgsExist
Parameters
keyQuery string field name
Returns
Value

References query_args.

◆ getQueryArg() [2/2]

const std::string & net::http::RequestHeader::getQueryArg ( const std::string & key,
const std::string & default_value ) const
nodiscard

References query_args.

◆ getType()

RequestType sese::net::http::RequestHeader::getType ( ) const
inlinenodiscard

◆ getUri()

const std::string & sese::net::http::RequestHeader::getUri ( ) const
inlinenodiscard

References uri.

◆ getUrl()

◆ getVersion()

HttpVersion sese::net::http::RequestHeader::getVersion ( ) const
inlinenodiscard

References version.

◆ queryArgsClear()

void sese::net::http::RequestHeader::queryArgsClear ( )
inline

References query_args.

◆ queryArgsEmpty()

bool sese::net::http::RequestHeader::queryArgsEmpty ( ) const
inlinenodiscard

References query_args.

◆ queryArgsExist()

bool sese::net::http::RequestHeader::queryArgsExist ( const std::string & key)
inline

References query_args.

◆ queryArgsSize()

size_t sese::net::http::RequestHeader::queryArgsSize ( ) const
inlinenodiscard

References query_args.

◆ setQueryArg()

void net::http::RequestHeader::setQueryArg ( const std::string & key,
const std::string & value )

◆ setType()

void sese::net::http::RequestHeader::setType ( RequestType request_type)
inline

◆ setUri()

void sese::net::http::RequestHeader::setUri ( const std::string & uri)
inline

References uri.

◆ setUrl()

void net::http::RequestHeader::setUrl ( const std::string & request_url)

◆ setVersion()

void sese::net::http::RequestHeader::setVersion ( HttpVersion new_version)
inline

Member Data Documentation

◆ query_args

std::map<std::string, std::string> sese::net::http::RequestHeader::query_args
protected

◆ type

RequestType sese::net::http::RequestHeader::type = RequestType::GET
protected

Referenced by getType(), and setType().

◆ uri

std::string sese::net::http::RequestHeader::uri = "/"
protected

Referenced by getUri(), and setUri().

◆ version

HttpVersion sese::net::http::RequestHeader::version = HttpVersion::VERSION_1_1
protected

Referenced by getVersion(), and setVersion().


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