This commit is contained in:
nate 2026-03-26 14:04:15 +04:00
parent b5c4e458d4
commit d844b495b2
1 changed files with 1 additions and 10 deletions

View File

@ -345,16 +345,7 @@ fn run_check_blocking(
const MAX_BODY: usize = 10 * 1024 * 1024; const MAX_BODY: usize = 10 * 1024 * 1024;
let body_str = match resp.body_mut().read_to_string() { let body_str = match resp.body_mut().read_to_string() {
Ok(s) => s, Ok(s) => s,
Err(e) => { Err(e) => format!("[failed to read body: {}]", e),
// Try reading as raw bytes (e.g. compressed or non-UTF-8 responses)
let mut buf = Vec::new();
let _ = std::io::Read::read_to_end(resp.body_mut().as_reader(), &mut buf);
if buf.is_empty() {
format!("[failed to read body: {}]", e)
} else {
String::from_utf8_lossy(&buf).into_owned()
}
}
}; };
let body_out = if body_str.len() > MAX_BODY { let body_out = if body_str.len() > MAX_BODY {
format!("[body truncated: {} bytes]", body_str.len()) format!("[body truncated: {} bytes]", body_str.len())