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

Add proxy Body::collect_bytes for easier unit tests #1445

Merged
merged 6 commits into from
Apr 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions kube-client/src/client/body.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@
Body::new(Kind::Wrap(body.map_err(Into::into).boxed_unsync()))
}

/// Collect all the data frames and trailers of the request body
pub async fn collect_bytes(self) -> Result<Bytes, crate::Error> {

Check warning on line 48 in kube-client/src/client/body.rs

View check run for this annotation

Codecov / codecov/patch

kube-client/src/client/body.rs#L48

Added line #L48 was not covered by tests
Ok(self.collect().await?.to_bytes())
}

pub(crate) fn into_data_stream(
self,
) -> impl Stream<Item = Result<<Self as HttpBody>::Data, <Self as HttpBody>::Error>> {
Expand Down
Loading