-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Feature: Implement the Body trait for more native data types to improve ergonomics #3746
Comments
Hi! I would like to try my hand on this issue. |
I've been personally torn on this. I appreciate the explicitness of having So, part of me resists adding it to any other standard buffer types. But I also understand that one exists, so should we just swallow the pill and provide the rest? Maybe. I don't love it. But perhaps I'm just wrong. |
I've launched a poll here #3747 . I say we give it a little bit and see what others think. |
It seems like 80% of people (granted, only out of 5 responses) want the body trait implemented on additional types. I can get started working on this if that's good with you @seanmonstar |
In hindsight, it makes sense to at least have an implementation for bytes if we have one for |
Are there any plans to have an implementation for more native data types? If yes, then I would love to work on this. |
I've already implemented this trait for |
Currently, the 'String' is the only native data type that implements
hyper::body::Body
.If we're passing other data types as a body, we need to add the
http_body_util
crate and add a little bit of boiler plate when building our request.Note: While the request builder itself may not require the body to implement the Body trait, both the sender and connection returned by
http1::handshake
require the request's body to implement it.With the body trait implemented for
Vec<u8>
(just one example that probably should implement body) we could leave out thehttp_body_util
crate. Building a request would also become more intuitive and ergonomic.The text was updated successfully, but these errors were encountered: