refine async API

- Converted `Response::text` and `Response::json` to `async fn`
- Added `Response::bytes` async fn as a counterpat to `text`.
- Added `Response::chunk` async fn to stream chunks of the response body.
- Added `From<Response> for Body` to allow piping a response as a request body.
- Removed `Decoder` from public API
- Removed body accessor methods from `Response`
- Removed `Chunk` type, replaced with `bytes::Bytes`.
- Removed public `impl Stream for Body`.
This commit is contained in:
Sean McArthur
2019-09-10 11:39:50 -07:00
parent 87a09322d6
commit 5356776834
11 changed files with 337 additions and 370 deletions

View File

@@ -1,6 +1,6 @@
pub use self::body::{Body, Chunk};
pub use self::body::Body;
pub use self::client::{Client, ClientBuilder};
pub use self::decoder::Decoder;
pub(crate) use self::decoder::Decoder;
pub use self::request::{Request, RequestBuilder};
pub use self::response::{Response, ResponseBuilderExt};