diff --git a/CHANGES.md b/CHANGES.md
index b623c163f..a406bdfa0 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -16,11 +16,11 @@
* Added http client
-* Added basic websocket client
+* Added websocket client
* Added TestServer::ws(), test websockets client
-* Added TestServer test http client
+* Added TestServer http client support
* Allow to override content encoding on application level
diff --git a/Cargo.toml b/Cargo.toml
index b7999b743..d8a4b93a9 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -77,6 +77,7 @@ tokio-tls = { version="0.1", optional = true }
openssl = { version="0.10", optional = true }
tokio-openssl = { version="0.2", optional = true }
+backtrace="*"
[dependencies.actix]
version = "0.5"
diff --git a/src/client/encoding.rs b/src/client/encoding.rs
new file mode 100644
index 000000000..4764d67b1
--- /dev/null
+++ b/src/client/encoding.rs
@@ -0,0 +1,142 @@
+use std::io;
+use std::io::{Read, Write};
+use bytes::{Bytes, BytesMut, BufMut};
+
+use flate2::read::GzDecoder;
+use flate2::write::DeflateDecoder;
+use brotli2::write::BrotliDecoder;
+
+use headers::ContentEncoding;
+use server::encoding::{Decoder, Wrapper};
+
+
+/// Payload wrapper with content decompression support
+pub(crate) struct PayloadStream {
+ decoder: Decoder,
+ dst: BytesMut,
+}
+
+impl PayloadStream {
+ pub fn new(enc: ContentEncoding) -> PayloadStream {
+ let dec = match enc {
+ ContentEncoding::Br => Decoder::Br(
+ Box::new(BrotliDecoder::new(BytesMut::with_capacity(8192).writer()))),
+ ContentEncoding::Deflate => Decoder::Deflate(
+ Box::new(DeflateDecoder::new(BytesMut::with_capacity(8192).writer()))),
+ ContentEncoding::Gzip => Decoder::Gzip(None),
+ _ => Decoder::Identity,
+ };
+ PayloadStream{ decoder: dec, dst: BytesMut::new() }
+ }
+}
+
+impl PayloadStream {
+
+ pub fn feed_eof(&mut self) -> io::Result