-
Notifications
You must be signed in to change notification settings - Fork 634
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implementation of sum/product Body types is impossible #884
Labels
Comments
How about if we change the constructor of reader and writer to something like this:
|
I believe that would solve this issue. |
vinniefalco
added
API Change
A breaking change
Design
Open design questions still present
labels
Nov 11, 2017
djarek
added a commit
to djarek/beast
that referenced
this issue
Dec 10, 2017
This change enables composing bodies into multiple layers e.g. compressed_body<json_body<T>>. Resolves boostorg#884. Actions required: - change body writer constructor signature to writer(header<isRequest, Fields> const&, value_type const&) - change body reader constructor signature to reader(header<isRequest, Fields>&, value_type&) Signed-off-by: Damian Jarek <damian.jarek93@gmail.com>
Closed
djarek
added a commit
to djarek/beast
that referenced
this issue
Dec 12, 2017
This change enables composing bodies into multiple layers e.g. compressed_body<json_body<T>>. Resolves boostorg#884. The old concepts signatures are supported if BOOST_BEAST_ALLOW_DEPRECATED is defined as 1. Actions required: - change BodyWriter constructor signature to writer(header<isRequest, Fields> const&, value_type const&) - change BodyReader constructor signature to reader(header<isRequest, Fields>&, value_type&) Signed-off-by: Damian Jarek <damian.jarek93@gmail.com>
djarek
added a commit
to djarek/beast
that referenced
this issue
Dec 14, 2017
fix boostorg#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).
vinniefalco
pushed a commit
to vinniefalco/beast
that referenced
this issue
Dec 14, 2017
fix boostorg#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).
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It is impossible to compose Bodies into sum types, e.g.:
due to the requirement of Body::reader and Body::writer that the message's body type is exactly the same type as Body. The same restriction applies to product types(not as useful as a variant_body). Not sure how to make this use-case possible without complicating other use-cases.
The text was updated successfully, but these errors were encountered: