Skip to content

update readme to include dependencies needed for example to run #755

Closed
@chrispickard

Description

Hey reqwest team,
Unfortunately I'm pretty new to rust and it wasn't clear how to get the example

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let resp: HashMap<String, String> =
        reqwest::get("https://httpbin.org/ip").await?.json().await?;
    println!("{:#?}", resp);
    Ok(())
}

to run. It turned out that I didn't just need reqwest = "0.10.0", but instead needed to enable the json feature as well as include tokio = { version = "0.2", features = ["full"] }

I understand why this is difficult to keep in sync with the (rapidly) evolving rust/async story, but
it would certainly be nice to have a copy/pastable example that runs without anything else.

Thanks!

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions