class test_response#

class test_response#

A type representing server’s outgoing response for testing purpose.

Public Functions

inline auto status() const noexcept -> const http::status_code&#

Get HTTP status code.

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

Get HTTP version.

inline auto headers() const noexcept -> const http::header_map&#

Get HTTP headers.

inline auto body() noexcept -> any_async_readable_stream&#

Get body.

inline auto body() const noexcept -> const any_async_readable_stream&#

Get body.

inline auto as_string() -> awaitable<expected<std::string, std::error_code>>#

Read complete body as std::string.

template<typename Byte>
inline auto as_vector() -> awaitable<expected<std::vector<Byte>, std::error_code>>#

Read complete body as std::vector<Byte>.

inline auto as_file(const std::string &path) -> awaitable<expected<std::size_t, std::error_code>>#

Read complete body into file.

template<typename T = boost::json::value>
inline auto as_json() -> awaitable<expected<T, std::error_code>>#

Read complete body into type T.