Skip to content

Commit 4459a6d

Browse files
committed
fix(decompression-plz): removed new_body usage in chunked_to_raw
1 parent a3ba0e6 commit 4459a6d

File tree

1 file changed

+2
-15
lines changed

1 file changed

+2
-15
lines changed

decompression-plz/src/chunked.rs

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,11 @@ where
2323
{
2424
let body = message.get_body().into_chunks();
2525
buf.reserve(total_chunk_size(&body));
26-
let mut new_body = buf.split();
2726
body.into_iter().for_each(|chunk| {
2827
match chunk {
2928
// 1. Combine ChunkType::Chunk into one body.
3029
ChunkType::Chunk(data) => {
31-
new_body.extend_from_slice(&data[..data.len() - 2])
30+
buf.extend_from_slice(&data[..data.len() - 2])
3231
}
3332
// 2. If trailer is present,
3433
ChunkType::Trailers(trailer) => {
@@ -41,7 +40,7 @@ where
4140
_ => (),
4241
}
4342
});
44-
message.set_body(Body::Raw(new_body));
43+
message.set_body(Body::Raw(buf.split()));
4544
}
4645

4746
// Partial chunked body
@@ -55,15 +54,3 @@ pub fn partial_chunked_to_raw(vec_body: Vec<ChunkType>) -> Option<BytesMut> {
5554

5655
Some(body)
5756
}
58-
59-
#[cfg(test)]
60-
mod tests {
61-
use super::*;
62-
extern crate tests_utils;
63-
use tests_utils::TestMessage;
64-
65-
#[test]
66-
fn test_chunked_to_raw() {
67-
let a: Option<TestMessage>;
68-
}
69-
}

0 commit comments

Comments
 (0)