class test_request_builder#

class test_request_builder#

A type for constructing an instance of test_request.

Public Functions

inline auto set_method(http::verb method) & noexcept -> test_request_builder&#

Set HTTP method.

inline auto set_version(http::version version) & noexcept -> test_request_builder&#

Set HTTP version.

inline auto set_header(std::string_view name, std::string_view value) & -> test_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) & -> test_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) & -> test_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) & -> test_request_builder&#

Insert HTTP headers.

DESCRIPTION

Insert HTTP headers. Note that any existing headers with the same name will be kept.

inline auto set_query(std::string name, std::string value) & -> test_request_builder&#

Set query string.

inline auto set_body() -> test_request#

Set a null body and create the test_request.

DESCRIPTION

Set a null body and create the test_request. If you do not want to modify the existing body, call build() 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) -> test_request#

Set a raw body and create the test_request.

DESCRIPTION

Set a raw body and create the test_request. Note that current object is no longer usable after calling this function.

inline auto set_body(std::string_view sv) -> test_request#

Set a raw body and create the test_request.

DESCRIPTION

Set a raw body and create the test_request. Note that current object is no longer usable after calling this function.

template<async_readable_stream AsyncReadableStream>
inline auto set_body(AsyncReadableStream &&stream) -> test_request#

Set a raw body and create the test_request.

DESCRIPTION

Set a raw body and create the test_request. Note that current object is no longer usable after calling this function.

inline auto set_json(const boost::json::value &jv) -> test_request#

Set a json object as the body and create the test_request.

DESCRIPTION

Set a json object as the body and create the test_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) -> test_request#

Set an object of type T that is converiable to a json object as the body and create the test_request.

DESCRIPTION

Set an object of type T that is converiable to a json object as the the body and create the test_request. Content-Type: application/json will be automatically inserted. Note that current object is no longer usable after calling this function.

template<async_readable_stream AsyncReadableStream>
inline auto set_stream_body(AsyncReadableStream &&stream) -> test_request#

Set a stream body and create the test_request.

DESCRIPTION

Set a stream body and create the test_request. A stream body will be sent with Transfer-Encoding: chunked. Note that current object is no longer usable after calling this function.

inline auto build() -> test_request#

Do not modify the body and create the test_request.

DESCRIPTION

Do not modify the body and create the test_request. If you want to remove existing body, call set_body() instead. Note that current object is no longer usable after calling this function.