Skip to content

Commit

Permalink
feat: Expose streaming as public API
Browse files Browse the repository at this point in the history
Signed-off-by: Xuanwo <[email protected]>
  • Loading branch information
Xuanwo committed Apr 22, 2024
1 parent 5806063 commit 0ac9e48
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions src/async_impl/body.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,24 @@ impl Body {
}
}

// pub?
pub(crate) fn streaming<B>(inner: B) -> Body
/// Wrap a `HttpBody` in a box inside `Body`.
///
/// # Example
///
/// ```
/// # use reqwest::Body;
/// # use futures_util;
/// # fn main() {
/// let content = "hello,world!".to_string();
///
/// let body = Body::streaming(content);
/// # }
/// ```
///
/// # Optional
///
/// This requires the `stream` feature to be enabled.
pub fn streaming<B>(inner: B) -> Body
where
B: HttpBody + Send + Sync + 'static,
B::Data: Into<Bytes>,
Expand Down

0 comments on commit 0ac9e48

Please sign in to comment.