Public Member Functions | |
ClientRequest (std::string url) | |
auto | method (const Method method) noexcept -> void |
auto | method () const noexcept -> Method |
auto | capture (std::string header) -> void |
auto | capture (std::initializer_list< std::string > headers) -> void |
auto | capture () -> void |
auto | header (std::string_view key, std::string_view value) -> void |
auto | header (std::string_view key, int value) -> void |
auto | url () const -> std::string_view |
auto | send () -> ClientResponse |
auto | send (std::istream &body) -> ClientResponse |
This class is used to perform a non-streaming HTTP request.
sourcemeta::hydra::http::ClientRequest::ClientRequest | ( | std::string | url | ) |
Construct an HTTP request to a given URL. For example:
auto sourcemeta::hydra::http::ClientRequest::capture | ( | ) | -> void |
Express a desire of capturing every response headers. For example:
auto sourcemeta::hydra::http::ClientRequest::capture | ( | std::initializer_list< std::string > | headers | ) | -> void |
Express a desire of capturing a set of response headers, if sent by the server.
auto sourcemeta::hydra::http::ClientRequest::capture | ( | std::string | header | ) | -> void |
Express a desire of capturing a specific response header, if sent by the server.
auto sourcemeta::hydra::http::ClientRequest::header | ( | std::string_view | key, |
int | value | ||
) | -> void |
Set an HTTP request header whose value is an integer. For example:
auto sourcemeta::hydra::http::ClientRequest::header | ( | std::string_view | key, |
std::string_view | value | ||
) | -> void |
Set an HTTP request header. For example:
|
noexcept |
Retrieve the HTTP method that the request will be sent with. For example:
|
noexcept |
Specify the HTTP method to use for the request. If not set, it defauls to GET
. For example:
auto sourcemeta::hydra::http::ClientRequest::send | ( | ) | -> ClientResponse |
Perform the HTTP request without a body. For example:
auto sourcemeta::hydra::http::ClientRequest::send | ( | std::istream & | body | ) | -> ClientResponse |
Perform the HTTP request with a body. For example:
auto sourcemeta::hydra::http::ClientRequest::url | ( | ) | const -> std::string_view |
Retrieve the URL that the request will be sent to. For example: