Boost C++ Libraries

PrevUpHomeNext

Function template response_from

boost::taar::response_from — Convert one or more values into an HTTP response.

Synopsis

// In header: <boost/taar/core/response_from.hpp>


template<has_response_from... T> constexpr auto response_from(T &&... value);

Description

Resolution order:

  • A user-defined tag_invoke(response_from_tag<...>, ...) overload found by ADL takes precedence.

  • Otherwise a built-in conversion is selected. Built-ins cover std::string, std::string_view, char const*, integral and floating-point values (rendered with std::format), boost::json::value (serialised as application/json), and std::span<std::byte const> / std::vector<std::byte> (sent as application/octet-stream).

Calling with no arguments returns a default empty 200 response, which is the response produced when a void-returning handler completes successfully.

Returns:

A value satisfying boost::taar::is_http_response or a boost::beast::http::message_generator.


PrevUpHomeNext