SNode.C
Loading...
Searching...
No Matches
web::http::client::Response Class Reference

#include <Response.h>

Collaboration diagram for web::http::client::Response:

Public Member Functions

 Response ()=default
 
 Response (Response &)=delete
 
 Response (Response &&) noexcept=default
 
Responseoperator= (Response &)=delete
 
Responseoperator= (Response &&) noexcept=delete
 
const std::string & get (const std::string &key, int i=0) const
 
const std::string & cookie (const std::string &key) const
 

Public Attributes

std::string httpVersion
 
std::string statusCode
 
std::string reason
 
int httpMajor = 0
 
int httpMinor = 0
 
CiStringMap< std::string > headers
 
CiStringMap< CookieOptionscookies
 
std::vector< char > body
 

Protected Attributes

ConnectionState connectionState = ConnectionState::Default
 

Private Attributes

std::string nullstr
 

Friends

class SocketContext
 
class ResponseParser
 

Detailed Description

Definition at line 38 of file Response.h.

Constructor & Destructor Documentation

◆ Response() [1/3]

web::http::client::Response::Response ( )
default

◆ Response() [2/3]

web::http::client::Response::Response ( Response & )
explicitdelete

◆ Response() [3/3]

web::http::client::Response::Response ( Response && )
explicitdefaultnoexcept

Member Function Documentation

◆ cookie()

const std::string & web::http::client::Response::cookie ( const std::string & key) const

Definition at line 47 of file Response.cpp.

47 {
48 const CiStringMap<CookieOptions>::const_iterator it = cookies.find(key);
49
50 if (it != cookies.end()) {
51 return it->second.getValue();
52 }
53
54 return nullstr;
55 }
CiStringMap< CookieOptions > cookies
Definition Response.h:63

References nullstr.

◆ get()

const std::string & web::http::client::Response::get ( const std::string & key,
int i = 0 ) const

Definition at line 31 of file Response.cpp.

31 {
32 if (headers.find(key) != headers.end()) {
33 std::pair<std::multimap<std::string, std::string>::const_iterator, std::multimap<std::string, std::string>::const_iterator>
34 range = headers.equal_range(key);
35
36 if (std::distance(range.first, range.second) >= i) {
37 std::advance(range.first, i);
38 return (*(range.first)).second;
39 }
40
41 return nullstr;
42 }
43
44 return nullstr;
45 }
CiStringMap< std::string > headers
Definition Response.h:62

References nullstr.

◆ operator=() [1/2]

Response & web::http::client::Response::operator= ( Response && )
deletenoexcept

◆ operator=() [2/2]

Response & web::http::client::Response::operator= ( Response & )
delete

Friends And Related Symbol Documentation

◆ ResponseParser

friend class ResponseParser
friend

Definition at line 71 of file Response.h.

◆ SocketContext

friend class SocketContext
friend

Definition at line 69 of file Response.h.

Member Data Documentation

◆ body

std::vector<char> web::http::client::Response::body

Definition at line 64 of file Response.h.

◆ connectionState

ConnectionState web::http::client::Response::connectionState = ConnectionState::Default
protected

Definition at line 52 of file Response.h.

◆ cookies

CiStringMap<CookieOptions> web::http::client::Response::cookies

Definition at line 63 of file Response.h.

◆ headers

CiStringMap<std::string> web::http::client::Response::headers

Definition at line 62 of file Response.h.

◆ httpMajor

int web::http::client::Response::httpMajor = 0

Definition at line 59 of file Response.h.

◆ httpMinor

int web::http::client::Response::httpMinor = 0

Definition at line 60 of file Response.h.

◆ httpVersion

std::string web::http::client::Response::httpVersion

Definition at line 56 of file Response.h.

◆ nullstr

std::string web::http::client::Response::nullstr
private

Definition at line 67 of file Response.h.

Referenced by cookie(), and get().

◆ reason

std::string web::http::client::Response::reason

Definition at line 58 of file Response.h.

◆ statusCode

std::string web::http::client::Response::statusCode

Definition at line 57 of file Response.h.


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