class request_builder
#
-
class request_builder#
A type for constructing an instance of
request
.Public Functions
-
inline auto set_method(http::verb method) & noexcept -> request_builder&#
Set HTTP method.
-
inline auto set_header(std::string_view name, std::string_view value) & -> request_builder&#
Set HTTP headers.
- DESCRIPTION
Set HTTP headers. The input
name
will be canonicalized before insertion. Note that any existing headers with the same name will be removed before the insertion.
-
inline auto set_header(http::field name, std::string_view value) & -> request_builder&#
Set HTTP headers.
- DESCRIPTION
Set HTTP headers. Note that any existing headers with the same name will be removed before the insertion.
-
inline auto insert_header(std::string_view name, std::string_view value) & -> request_builder&#
Insert HTTP headers.
- DESCRIPTION
Insert HTTP headers. The input
name
will be canonicalized before insertion. Note that any existing headers with the same name will be kept.
-
inline auto insert_header(http::field name, std::string_view value) & -> request_builder&#
Insert HTTP headers.
- DESCRIPTION
Insert HTTP headers. Note that any existing headers with the same name will be kept.
-
inline auto headers() noexcept -> http::header_map&#
Get HTTP headers map.
-
inline auto set_query(std::string name, std::string value) & -> request_builder&#
Set query string.
-
inline auto set_body() -> request#
Set a null body and create the
response
.- DESCRIPTION
Set a null body and create the
response
. If you do not want to modify the existing body, callbuild()
instead. Note that current object is no longer usable after calling this function.
-
template<std::size_t N>
inline auto set_body(std::span<const std::byte, N> bytes) -> request# Set a raw body and create the
request
.- DESCRIPTION
Set a raw body and create the
request
. Note that current object is no longer usable after calling this function.
-
inline auto set_body(std::string_view sv) -> request#
Set a raw body and create the
request
.- DESCRIPTION
Set a raw body and create the
request
. Note that current object is no longer usable after calling this function.
-
template<async_readable_stream AsyncReadableStream>
inline auto set_body(AsyncReadableStream &&stream) -> request# Set a raw body and create the
request
.- DESCRIPTION
Set a raw body and create the
request
. Note that current object is no longer usable after calling this function.
-
inline auto set_json(const boost::json::value &jv) -> request#
Set a json object as the body and create the
request
.- DESCRIPTION
Set a json object as the body and create the
request
.Content-Type: application/json
will be automatically inserted. Note that current object is no longer usable after calling this function.
-
template<typename T>
inline auto set_json(const T &obj) -> request# Set an object of type
T
that is converiable to a json object as the body and create therequest
.- DESCRIPTION
Set an object of type
T
that is converiable to a json object as the the body and create therequest
.Content-Type: application/json
will be automatically inserted. Note that current object is no longer usable after calling this function.
-
inline auto set_method(http::verb method) & noexcept -> request_builder&#