docs(client): add improved usage examples
This commit is contained in:
		| @@ -5,18 +5,32 @@ | |||||||
| //! The `Client` API is designed for most people to make HTTP requests. | //! The `Client` API is designed for most people to make HTTP requests. | ||||||
| //! It utilizes the lower level `Request` API. | //! It utilizes the lower level `Request` API. | ||||||
| //! | //! | ||||||
| //! ```no_run | //! ## GET | ||||||
| //! use hyper::Client; |  | ||||||
| //! | //! | ||||||
|  | //! ```no_run | ||||||
|  | //! # use hyper::Client; | ||||||
| //! let mut client = Client::new(); | //! let mut client = Client::new(); | ||||||
| //! | //! | ||||||
| //! let mut res = client.get("http://example.domain").send().unwrap(); | //! let res = client.get("http://example.domain").send().unwrap(); | ||||||
| //! assert_eq!(res.status, hyper::Ok); | //! assert_eq!(res.status, hyper::Ok); | ||||||
| //! ``` | //! ``` | ||||||
| //! | //! | ||||||
| //! The returned value from is a `Response`, which provides easy access | //! The returned value is a `Response`, which provides easy access to | ||||||
| //! to the `status`, the `headers`, and the response body via the `Writer` | //! the `status`, the `headers`, and the response body via the `Read` | ||||||
| //! trait. | //! trait. | ||||||
|  | //! | ||||||
|  | //! ## POST | ||||||
|  | //! | ||||||
|  | //! ```no_run | ||||||
|  | //! # use hyper::Client; | ||||||
|  | //! let mut client = Client::new(); | ||||||
|  | //! | ||||||
|  | //! let res = client.post("http://exmaple.domain") | ||||||
|  | //!     .body("foo=bar") | ||||||
|  | //!     .send() | ||||||
|  | //!     .unwrap(); | ||||||
|  | //! assert_eq!(res.status, hyper::Ok); | ||||||
|  | //! ``` | ||||||
| use std::default::Default; | use std::default::Default; | ||||||
| use std::io::{self, copy, Read}; | use std::io::{self, copy, Read}; | ||||||
| use std::iter::Extend; | use std::iter::Extend; | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user