shio-rs icon indicating copy to clipboard operation
shio-rs copied to clipboard

Remove dependency on hyper::Body for shio::Response

Open cetra3 opened this issue 8 years ago • 0 comments

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).

cetra3 avatar Sep 27 '17 03:09 cetra3