Make the async Client default (#626)
The previously default Client is moved to `reqwest::blocking`, while the async client becomes the main API. Closes #622
This commit is contained in:
22
README.md
22
README.md
@@ -20,13 +20,29 @@ preparing breaking changes, for most recently released code, look to the
|
||||
|
||||
## Example
|
||||
|
||||
```rust,no_run
|
||||
extern crate reqwest;
|
||||
Async:
|
||||
|
||||
```rust,no_run
|
||||
use std::collections::HashMap;
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() -> Result<(), Box<std::error::Error>> {
|
||||
let resp: HashMap<String, String> = reqwest::get("https://httpbin.org/ip")
|
||||
.await?
|
||||
.json()
|
||||
.await?;
|
||||
println!("{:#?}", resp);
|
||||
Ok(())
|
||||
}
|
||||
```
|
||||
|
||||
Blocking:
|
||||
|
||||
```rust,no_run
|
||||
use std::collections::HashMap;
|
||||
|
||||
fn main() -> Result<(), Box<std::error::Error>> {
|
||||
let resp: HashMap<String, String> = reqwest::get("https://httpbin.org/ip")?
|
||||
let resp: HashMap<String, String> = reqwest::blocking::get("https://httpbin.org/ip")?
|
||||
.json()?;
|
||||
println!("{:#?}", resp);
|
||||
Ok(())
|
||||
|
||||
Reference in New Issue
Block a user