fn main() -> Result<(), barehttp::Error> {
let response = barehttp::get("http://httpbingo.org/gzip").call()?;
let body = response.to_text()?;
assert!(
!body.as_bytes().starts_with(&[0x1f, 0x8b]),
"body still looks gzip-compressed"
);
assert!(
body.contains('{') || body.to_ascii_lowercase().contains("gzip"),
"expected readable JSON/text in decompressed body, got: {}",
body.chars().take(200).collect::<String>()
);
println!("{} {}", response.status_code(), body);
Ok(())
}