New BodyReader and BodyWriter constructors (API Change):

fix #884

* BodyReader and BodyWriter constructors now require the header and
  body elements to be passed as distinct header and value_type objects.

This enables the composition of body types, for example:

    http::response<compressed_body<http::string_body>> res;

* The previous single-argument constructors are deprecated and will be
  removed in a subsequent version.

Actions Required:

* Change user-defined instances of BodyReader or BodyWriter constructor
  signatures to the two-argument form.

OR

* Define the macro BOOST_BEAST_ALLOW_DEPRECATED in the project (which
  will accept both the new and the deprecated signatures).
This commit is contained in:
Damian Jarek authored and Vinnie Falco committed 2017-12-15 09:27:39 -08:00
1 parent d796319476
commit b76ab4450a
24 files changed
+358 -107

No files matched your search

+2 -2
View File
@@ -34,7 +34,7 @@ struct span_body_test
BEAST_EXPECT(req.body().size() == 3);
BEAST_EXPECT(B::size(req.body()) == 3);
B::writer r{req};
B::writer r{req, req.body()};
error_code ec;
r.init(ec);
BEAST_EXPECTS(! ec, ec.message());
@@ -50,7 +50,7 @@ struct span_body_test
using B = span_body<char>;
request<B> req;
req.body() = span<char>{buf, sizeof(buf)};
B::reader w{req};
B::reader w{req, req.body()};
error_code ec;
w.init(boost::none, ec);
BEAST_EXPECTS(! ec, ec.message());