</>
Plan du cours — 44/66

reqwest — client HTTP

Intermédiaire
cargo add reqwest -F json
#[derive(serde::Deserialize, Debug)]
struct Repo { name: String, stargazers_count: u32 }

let client = reqwest::Client::new();
let repo: Repo = client
    .get("https://api.github.com/repos/rust-lang/rust")
    .header("User-Agent", "mon-app")
    .send()
    .await?
    .error_for_status()?
    .json()
    .await?;