| @@ -51,6 +51,11 @@ impl Response { | |||||||
|         &mut self.headers |         &mut self.headers | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  |     /// Consumes the response, returning the body | ||||||
|  |     pub fn into_body(self) -> Decoder { | ||||||
|  |         self.body | ||||||
|  |     } | ||||||
|  |  | ||||||
|     /// Get a reference to the response body. |     /// Get a reference to the response body. | ||||||
|     #[inline] |     #[inline] | ||||||
|     pub fn body(&self) -> &Decoder { |     pub fn body(&self) -> &Decoder { | ||||||
|   | |||||||
| @@ -8,8 +8,7 @@ extern crate libflate; | |||||||
| #[macro_use] | #[macro_use] | ||||||
| mod support; | mod support; | ||||||
|  |  | ||||||
| use std::mem; | use reqwest::unstable::async::Client; | ||||||
| use reqwest::unstable::async::{Client, Decoder}; |  | ||||||
| use futures::{Future, Stream}; | use futures::{Future, Stream}; | ||||||
| use tokio_core::reactor::Core; | use tokio_core::reactor::Core; | ||||||
| use std::io::Write; | use std::io::Write; | ||||||
| @@ -64,8 +63,8 @@ fn test_gzip(response_size: usize, chunk_size: usize) { | |||||||
|  |  | ||||||
|     let res_future = client.get(&format!("http://{}/gzip", server.addr())) |     let res_future = client.get(&format!("http://{}/gzip", server.addr())) | ||||||
|         .send() |         .send() | ||||||
|         .and_then(|mut res| { |         .and_then(|res| { | ||||||
|             let body = mem::replace(res.body_mut(), Decoder::empty()); |             let body = res.into_body(); | ||||||
|             body.concat2() |             body.concat2() | ||||||
|         }) |         }) | ||||||
|         .and_then(|buf| { |         .and_then(|buf| { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user