1 unstable release
0.1.0 | Jun 27, 2023 |
---|
#2467 in Development tools
6KB
Header info parser for reqwest crate
Examples
#[tokio::main]
async fn main() {
let header_data = r##"
GET /api/v1/crates?page=1&per_page=10&q={} HTTP/2
Host: crates.io
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/106.0.5249.119 Safari/537.36
Referer: https://crates.io/search?q=doe
Sec-Fetch-Site: same-origin
Sec-Fetch-Mode: cors
Sec-Fetch-Dest: empty
"##.format(name);
let info = reqwest_header::parse_to_reqwest_header(&header_data).unwrap();
let cilent = reqwest::Client::new();
let response = cilent
.get(info.url)
.headers(info.header)
.send()
.await
.unwrap();
let test = response.text().await.unwrap().to_string();
}
Dependencies
~4–15MB
~207K SLoC