๐Ÿ“ฆ Kong / httpsnippet

๐Ÿ“„ cookies.rs ยท 23 lines
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23use reqwest;

#[tokio::main]
pub async fn main() {
    let url = "http://mockbin.com/har";

    let mut headers = reqwest::header::HeaderMap::new();
    headers.insert("cookie", "foo=bar; bar=baz".parse().unwrap());

    let client = reqwest::Client::new();
    let response = client.post(url)
        .headers(headers)
        .send()
        .await;

    let results = response.unwrap()
        .json::<serde_json::Value>()
        .await
        .unwrap();

    dbg!(results);
}