Skip to content

Make warp::body::Body::wrap_stream public #1160

@robinfriedli

Description

@robinfriedli

Is your feature request related to a problem? Please describe.
I'm currently upgrading from warp 0.3 and have hit a roadblock in a route where I stream a file from the network to the response body. Previously I used a hyper::Body::channel() for that, which doesn't exist anymore in hyper v1.

Describe the solution you'd like
I've been trying to implement an alternative using http_body_util or tokio_stream that might look like this:

    let (sender, receiver) = mpsc::channel::<Result<Bytes, Error>>(16);
    let body = warp::body::Body::wrap_stream(ReceiverStream::new(receiver));

problem is that bodyt is private, otherwise it seems that would be a possible solution

Describe alternatives you've considered
Bypass warp for this route entirely and handle it in a hyper service fn instead but I'd prefer not to.

Metadata

Metadata

Assignees

No one assigned

    Labels

    featureNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions