reqwest-header

Crates.ioreqwest-header
lib.rsreqwest-header
version0.1.0
sourcesrc
created_at2023-06-27 05:28:32.300175
updated_at2023-06-27 05:28:32.300175
descriptionHeader info parser for reqwest crate
homepage
repositoryhttps://gitlab.com/andrew_ryan/reqwest-header
max_upload_size
id901006
size6,543
zinso (zinso)

documentation

https://docs.rs/reqwest-header

README

Header info parser for reqwest crate

Crates.io Rust license

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();
}
Commit count: 0

cargo fmt