olp-cpp-sdk
1.18.1
|
This class represents the HTTP response created from the NetworkResponse and the request body. More...
#include <HttpResponse.h>
Public Member Functions | |
HttpResponse (int status, std::string response={}) | |
Creates the HttpResponse instance. More... | |
HttpResponse (int status, std::stringstream &&response) | |
Creates the HttpResponse instance. More... | |
HttpResponse (int status, std::stringstream &&response, http::Headers headers) | |
Creates the HttpResponse instance. More... | |
HttpResponse (const HttpResponse &other) | |
A copy constructor. More... | |
HttpResponse & | operator= (const HttpResponse &other) |
A copy assignment operator. More... | |
HttpResponse (HttpResponse &&)=default | |
A default move constructor. | |
HttpResponse & | operator= (HttpResponse &&)=default |
A default move assignment operator. | |
void | GetResponse (std::vector< unsigned char > &output) |
Copy HttpResponse content to a vector of unsigned chars. More... | |
void | GetResponse (std::string &output) const |
Copy HttpResponse content to a string. More... | |
const http::Headers & | GetHeaders () const |
Return the const reference to the response headers. More... | |
int | GetStatus () const |
Return the response status. More... | |
void | SetNetworkStatistics (NetworkStatistics network_statistics) |
Set NetworkStatistics . More... | |
const NetworkStatistics & | GetNetworkStatistics () const |
Get the NetworkStatistics . More... | |
Public Attributes | |
int | status {static_cast<int>(olp::http::ErrorCode::UNKNOWN_ERROR)} |
std::stringstream | response |
http::Headers | headers |
This class represents the HTTP response created from the NetworkResponse and the request body.
|
inline |
Creates the HttpResponse
instance.
status | The HTTP status. |
response | The response body. |
|
inline |
Creates the HttpResponse
instance.
status | The HTTP status. |
response | The response body. |
|
inline |
Creates the HttpResponse
instance.
status | The HTTP status. |
response | The response body. |
headers | Response headers. |
|
inline |
A copy constructor.
This copy constructor creates a deep copy of the response body if a non-shareable container type is used.
other | The instance of HttpStatus to copy from. |
|
inline |
Return the const reference to the response headers.
|
inline |
Get the NetworkStatistics
.
NetworkStatistics
previously set.
|
inline |
Copy HttpResponse
content to a string.
output | Reference to a string. |
|
inline |
Copy HttpResponse
content to a vector of unsigned chars.
output | Reference to a vector. |
|
inline |
Return the response status.
The response status can either be an ErrorCode
if negative or a HttpStatusCode
if positive.
|
inline |
A copy assignment operator.
This copy assignment operator creates a deep copy of the response body if a non-shareable container type is used.
other | The instance of HttpStatus to copy from. |
|
inline |
Set NetworkStatistics
.
network_statistics | Instance of NetworkStatistics . |
http::Headers olp::client::HttpResponse::headers |
HTTP headers.
GetHeaders()
method instead. std::stringstream olp::client::HttpResponse::response |
The HTTP response.
GetResponse()
methods instead. int olp::client::HttpResponse::status {static_cast<int>(olp::http::ErrorCode::UNKNOWN_ERROR)} |
The HTTP Status. This can be either a ErrorCode
if negative or a HttpStatusCode
if positive.
GetStatus()
method instead.