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

Expose Body::streaming as public API #2243

Closed
Xuanwo opened this issue Apr 10, 2024 · 1 comment · Fixed by #2255
Closed

Expose Body::streaming as public API #2243

Xuanwo opened this issue Apr 10, 2024 · 1 comment · Fixed by #2255

Comments

@Xuanwo
Copy link
Contributor

Xuanwo commented Apr 10, 2024

Hi, http_body is reaching 1.0 now, maybe it's time for us to make Body::streaming public?

// pub?
pub(crate) fn streaming<B>(inner: B) -> Body
where
B: HttpBody + Send + Sync + 'static,
B::Data: Into<Bytes>,
B::Error: Into<Box<dyn std::error::Error + Send + Sync>>,
{
use http_body_util::BodyExt;
let boxed = inner
.map_frame(|f| f.map_data(Into::into))
.map_err(Into::into)
.boxed();
Body {
inner: Inner::Streaming(boxed),
}
}

This change will:

I'm willing to submit a PR if you feel this looks good.

@rogusdev
Copy link

Would this make it possible to also easily add streaming in wasm per #2248 ?

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

Successfully merging a pull request may close this issue.

2 participants