Skip to content

Commit d7cb38f

Browse files
committed
feat(decompression-plz): added methods for determining only chunked and identity transfer encoding and only identity content encoding for DecodeStruct
1. is_chunked_te_only 2. is_identity_te_only 3. is_identity_ce_only
1 parent 8f20a44 commit d7cb38f

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

decompression-plz/src/decode_struct.rs

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
use bytes::BytesMut;
22
use header_plz::body_headers::BodyHeader;
3+
use header_plz::body_headers::content_encoding::ContentEncoding;
34
use header_plz::body_headers::encoding_info::EncodingInfo;
45

56
use crate::decompression::multi::error::MultiDecompressError;
@@ -48,6 +49,27 @@ where
4849
.is_some()
4950
}
5051

52+
pub fn is_chunked_te_only(&self) -> bool {
53+
self.body_headers
54+
.as_ref()
55+
.and_then(|bh| Some(bh.is_chunked_te_only()))
56+
.unwrap_or(false)
57+
}
58+
59+
pub fn is_identity_te_only(&self) -> bool {
60+
self.body_headers
61+
.as_ref()
62+
.and_then(|bh| Some(bh.is_identity_te_only()))
63+
.unwrap_or(false)
64+
}
65+
66+
pub fn is_identity_ce_only(&self) -> bool {
67+
self.body_headers
68+
.as_ref()
69+
.and_then(|bh| Some(bh.is_identity_ce_only()))
70+
.unwrap_or(false)
71+
}
72+
5173
pub fn transfer_encoding(&mut self) -> Vec<EncodingInfo> {
5274
self.body_headers.as_mut().unwrap().transfer_encoding.take().unwrap()
5375
}
@@ -60,6 +82,10 @@ where
6082
self.extra_body.is_some()
6183
}
6284

85+
pub fn extra_body_is_none(&self) -> bool {
86+
self.extra_body.is_none()
87+
}
88+
6389
pub fn take_main_body(&mut self) -> BytesMut {
6490
self.body.split()
6591
}

0 commit comments

Comments
 (0)