Skip to content

Commit

Permalink
feat: Add Collected::take_trailers
Browse files Browse the repository at this point in the history
  • Loading branch information
swlynch99 committed Mar 14, 2024
1 parent b5c769d commit 2533f8f
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions http-body-util/src/collected.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,13 @@ impl<B: Buf> Collected<B> {
self.trailers.as_ref()
}

/// If there is a trailers frame buffered, remove and return it.
///
/// Returns `None` if the body contained no trailers.
pub fn take_trailers(&mut self) -> Option<HeaderMap> {
self.trailers.take()
}

/// Aggregate this buffered into a [`Buf`].
pub fn aggregate(self) -> impl Buf {
self.bufs
Expand Down

0 comments on commit 2533f8f

Please sign in to comment.