hyperium / http-body

Asynchronous HTTP body trait
MIT License
129 stars 50 forks source link

`AnyBody`? #107

Closed aviramha closed 7 months ago

aviramha commented 8 months ago

I'm trying to help the upgrade of kube-rs. We're a bit confused with the new Body trait and in our case kube-rs implements a tower Service so users can build their own stacks. The issue is that it requires to know the body type ahead of time (it can be different types based on the exact request used). https://github.com/kube-rs/kube/blob/c2983f6d196daecde39069f7ab322375ff9d1566/kube-client/src/client/mod.rs#L68

I was thinking maybe there should be an AnyBody enum, that takes the simple types that are implemented in this crate and sums it so then the service can use this as well. Maybe I have wrong idea of that design but would be help to hear your thoughts.

clux commented 7 months ago

Update: this is resolved via a hyper contributor writing a custom Body type for us (thanks again!) that we now use in kube: https://github.com/kube-rs/kube/blob/2ff3a2d50428f3f7d1ef9633b59e938346128688/kube-client/src/client/body.rs#L14-L86