![]() |
boost::taar::handler::stream_body_arg — Argument provider that hands the callable a body_reader for an incrementally read request body.
// In header: <boost/taar/handler/rest_arg.hpp> struct stream_body_arg { // public member functions template<typename... T> stream_body_arg(T &&...); stream_body_arg(all_content_types_t, description = {}); std::string name() const; std::string const & description() const; std::unordered_set< std::string > const & content_types() const; taar::result< std::reference_wrapper< body_reader > > operator()(streaming_request const &, matcher::context const &) const; // public data members std::unordered_set< std::string > content_types_; std::string description_; };
The callable parameter must be body_reader&. The body is not buffered and the session's body limit does not apply; use body_reader::read_some or read_all(limit). Like the other body providers, content types may be restricted; by default any content type is accepted.
rest([](taar::body_reader& body) -> taar::awaitable<std::string> { std::uint64_t total = 0; while (!body.done()) total += (co_await body.read_some()).size(); co_return std::to_string(total); }, stream_body_arg {});
stream_body_arg public member functionstemplate<typename... T> stream_body_arg(T &&... args);
stream_body_arg(all_content_types_t, description d = {});
std::string name() const;
std::string const & description() const;
std::unordered_set< std::string > const & content_types() const;
taar::result< std::reference_wrapper< body_reader > > operator()(streaming_request const & request, matcher::context const &) const;