diff --git a/include/boost/capy/io/any_write_sink.hpp b/include/boost/capy/io/any_write_sink.hpp index 2047bc99d..39900c6bd 100644 --- a/include/boost/capy/io/any_write_sink.hpp +++ b/include/boost/capy/io/any_write_sink.hpp @@ -854,7 +854,7 @@ template io_task any_write_sink::write(CB buffers) { - buffer_param bp(buffers); + const_buffer_param bp(buffers); std::size_t total = 0; for(;;) diff --git a/test/unit/io/any_write_sink.cpp b/test/unit/io/any_write_sink.cpp index 1b0f09034..a57cac86f 100644 --- a/test/unit/io/any_write_sink.cpp +++ b/test/unit/io/any_write_sink.cpp @@ -302,6 +302,27 @@ class any_write_sink_test BOOST_TEST(r.success); } + void + testWriteMutableSequence() + { + test::fuse f; + auto r = f.armed([&](test::fuse&) -> task<> { + test::write_sink ws(f); + + any_write_sink aws(&ws); + + std::string body = "hello world"; + auto [ec, n] = co_await aws.write(make_buffer(body)); + if(ec) + co_return; + + BOOST_TEST_EQ(n, 11u); + BOOST_TEST_EQ(ws.data(), "hello world"); + BOOST_TEST(!ws.eof_called()); + }); + BOOST_TEST(r.success); + } + void testWriteMultiple() { @@ -775,6 +796,7 @@ class any_write_sink_test testWriteSomeEmptyBuffer(); testWriteEmptyBuffer(); testWrite(); + testWriteMutableSequence(); testWriteMultiple(); testWriteBufferSequence(); testWriteSingleBuffer();