shio-rs
shio-rs copied to clipboard
Remove dependency on hyper::Body for shio::Response
Following from https://github.com/hyperium/hyper/issues/1328
Currently the type signature of the shio::Response is heavily coupled to hyper::Body:
pub struct Response {
pub inner: hyper::Response<hyper::Body>,
}
And setting the body requires that it can be at least converted into a hyper::Body:
pub fn set_body<B: Into<hyper::Body>>(&mut self, body: B) {
self.inner.set_body(body.into());
}
The body could possibly be more generic, as per the hyper crate which would allow such things as providing a Stream directly to the body, simplifying implementation for more tricky things (like streaming files from disk).