Skip to content

Commit b59557f

Browse files
committed
feat(decompression-plz): added EncodingType enum - to select Transfer or Content Encoding
1 parent 2c089d7 commit b59557f

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
use header_plz::body_headers::{BodyHeader, encoding_info::EncodingInfo};
2+
3+
pub enum EncodingType {
4+
TransferEncoding,
5+
ContentEncoding,
6+
}
7+
8+
impl EncodingType {
9+
pub fn encoding_info<'a>(
10+
&self,
11+
body_headers: Option<&'a mut BodyHeader>,
12+
) -> Option<&'a mut Vec<EncodingInfo>> {
13+
match self {
14+
EncodingType::TransferEncoding => {
15+
body_headers.and_then(|bh| bh.transfer_encoding.as_mut())
16+
}
17+
EncodingType::ContentEncoding => {
18+
body_headers.and_then(|bh| bh.content_encoding.as_mut())
19+
}
20+
}
21+
}
22+
}

0 commit comments

Comments
 (0)