Public Member Functions | |
RawResult () | |
RawResult (int code) | |
RawResult (const std::string &reply) | |
RawResult (const std::string &reply, int code) | |
bool | hasError () const |
int | httpStatusCode () const |
bool | isEmpty () const |
operator bool () const | |
const std::string & | reply () const |
void | setHttpStatusCode (int code) |
void | setReply (const std::string &reply) |
The class RawResult encapsulates the plain reply of a Crate HTTP endpoint request. It consists only of two information: the HTTP status code and the server's reply.
The reply is typically the JSON data received from the endpoint. In case the cluster could not be reached due to network problems this error is also wrapped in a Crate like error. In addition, however, the object is extended by the key "component" with the value "curl":
CppCrate::RawResult::RawResult | ( | ) |
Constructs an empty result.
|
explicit |
Constructs a result with the HTTP status code code.
|
explicit |
Constructs a result with the reply reply.
CppCrate::RawResult::RawResult | ( | const std::string & | reply, |
int | code | ||
) |
Constructs a result with the reply reply and the HTTP status code code.
bool CppCrate::RawResult::hasError | ( | ) | const |
Returns whether the reply contains an error. An empty reply or ill formed JSON are considered erroneous. For bulk operations true
is returned if at least one operation failed.
int CppCrate::RawResult::httpStatusCode | ( | ) | const |
Returns the HTTP status code.
bool CppCrate::RawResult::isEmpty | ( | ) | const |
Returns whether the result is empty.
|
explicit |
Returns whether the reply contains an error.
const std::string & CppCrate::RawResult::reply | ( | ) | const |
Returns the server's reply.
void CppCrate::RawResult::setHttpStatusCode | ( | int | code | ) |
Sets the HTTP status code to code.
void CppCrate::RawResult::setReply | ( | const std::string & | reply | ) |
Sets the reply to reply.