Public Member Functions | |
auto | status () const noexcept -> Status |
auto | header (const std::string &key) const -> std::optional< std::string > |
auto | headers () const -> const std::unordered_map< std::string, std::string > & |
auto | empty () noexcept -> bool |
auto | body () -> std::istringstream & |
This class represents a non-streaming HTTP response.
auto sourcemeta::hydra::http::ClientResponse::body | ( | ) | -> std::istringstream & |
Obtain the response body as an input stream. Getting the response body of an empty response is undefined behavior. Remember to check for this case using sourcemeta::hydra::http::ClientResponse::empty. For example:
|
noexcept |
Check whether a response has a body to consume or not. A request made with the HEAD
HTTP method is almost always empty. Remember to always check if a response is empty before calling sourcemeta::hydra::http::ClientResponse::body.
For example:
auto sourcemeta::hydra::http::ClientResponse::header | ( | const std::string & | key | ) | const -> std::optional< std::string > |
Get the value of a given response header, if any. Remember that you must express your desire of capturing the response headers you are interest in when performing the request, using sourcemeta::hydra::http::ClientRequest::capture.
auto sourcemeta::hydra::http::ClientResponse::headers | ( | ) | const -> const std::unordered_map< std::string, std::string > & |
Get a container for all the captured response headers. For example:
|
noexcept |
Get the status code of the response. For example: