Gzip response is not decompressed

Viewed 211

I am trying to decompress a gzipped response. reqwest has a client builder flag that enables decompressing with features flag gzip. I am using async client with tokio runtime.

//Cargo.toml
reqwest = { version = "0.11.8", features = ["gzip"] }
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = reqwest::ClientBuilder::new()
        .gzip(true)
        .build()?;
    let b = client
        .get("https://wiki.mozilla.org/images/f/ff/Example.json.gz")
        .send()
        .await?
        .text()
        .await?;
        
    println!("{}", b);
    Ok(())
}
0 Answers
Related