Skip to content
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

Body::chain method to chain two Body instances together #804

Closed
joshtriplett opened this issue Feb 25, 2021 · 3 comments
Closed

Body::chain method to chain two Body instances together #804

joshtriplett opened this issue Feb 25, 2021 · 3 comments

Comments

@joshtriplett
Copy link
Member

Sometimes, you have two or more things that can be turned into a Body (for instance, a String and a Read instance), and you want to chain them together. I'd love to have a direct method to chain these together (which could delegate to Read::chain).

@jbr
Copy link
Member

jbr commented Feb 25, 2021

Would Body::from_string(&my_string).chain(Body::from_reader(&stdin, None)) really be preferable to Body::from_reader(Cursor::new(&my_string).chain(&stdin), None)?

@joshtriplett
Copy link
Member Author

Yes, not least of which because it's possible to get the lengths right if known.

http-rs/http-types#342

@joshtriplett
Copy link
Member Author

This is now merged in http-types. It'll be available in tide when tide migrates to the new version of http-types.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants