When trying to write a simple server, I noticed that when writing to a corosio tcp_socket creating the const buffer for the write is rather ugly. Since these libraries are already so tied together methods/overloads for working with capy/corosio would be nice. For example this:
http::response res;
res.set_status(http::status::ok);
auto [ec, n] = co_await m_socket.write_some(
capy::const_buffer{res.buffer().data(), res.buffer().size()});
Unless I missed some very obvious method, there is no nice way to pass an http::request to write_some. Just .buffer() doesn't work as write_some doesn't accept a string_view.
When trying to write a simple server, I noticed that when writing to a corosio tcp_socket creating the const buffer for the write is rather ugly. Since these libraries are already so tied together methods/overloads for working with capy/corosio would be nice. For example this:
http::response res; res.set_status(http::status::ok); auto [ec, n] = co_await m_socket.write_some( capy::const_buffer{res.buffer().data(), res.buffer().size()});Unless I missed some very obvious method, there is no nice way to pass an http::request to write_some. Just .buffer() doesn't work as write_some doesn't accept a string_view.