Fix client example so it compiles
`URL::parse()` needs an `unwrap()`, the `let res = ...` needs a semicolon, and I changed the example to set a real header.
This commit is contained in:
@@ -46,17 +46,17 @@ Client:
|
|||||||
```rust
|
```rust
|
||||||
fn main() {
|
fn main() {
|
||||||
// Creating an outgoing request.
|
// Creating an outgoing request.
|
||||||
let mut req = Request::get(Url::parse("http://www.gooogle.com/")).unwrap();
|
let mut req = Request::get(Url::parse("http://www.gooogle.com/").unwrap()).unwrap();
|
||||||
|
|
||||||
// Setting a header.
|
// Setting a header.
|
||||||
req.headers_mut().set(Foo);
|
req.headers_mut().set(Connection(vec![Close]));
|
||||||
|
|
||||||
// Start the Request, writing headers and starting streaming.
|
// Start the Request, writing headers and starting streaming.
|
||||||
let res = req.start().unwrap()
|
let res = req.start().unwrap()
|
||||||
// Send the Request.
|
// Send the Request.
|
||||||
.send().unwrap()
|
.send().unwrap()
|
||||||
// Read the Response.
|
// Read the Response.
|
||||||
.read_to_string().unwrap()
|
.read_to_string().unwrap();
|
||||||
|
|
||||||
println!("Response: {}", res);
|
println!("Response: {}", res);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user