Skip to content

Commit cd52d9d

Browse files
committed
feat: Add Collected::take_trailers
1 parent b5c769d commit cd52d9d

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

http-body-util/src/collected.rs

+7
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,13 @@ impl<B: Buf> Collected<B> {
2828
self.trailers.as_ref()
2929
}
3030

31+
/// If there is a trailers frame buffered, remove and return it.
32+
///
33+
/// Returns `None` if the body contained no trailers.
34+
pub fn take_trailers(&mut self) -> Option<HeaderMap> {
35+
self.trailers.take()
36+
}
37+
3138
/// Aggregate this buffered into a [`Buf`].
3239
pub fn aggregate(self) -> impl Buf {
3340
self.bufs

0 commit comments

Comments
 (0)