1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
extern crate reqwest;

use std::collections::HashMap;

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

pub fn another_query() -> Result<(), Box<std::error::Error>> {
    let body = reqwest::get("https://jaredforthmusic.com")?
        .text()?;
    
    println!("The body: {}", body);
    Ok(())
}