truncate_body

Function truncate_body 

Source
fn truncate_body(body: &str, max_chars: usize) -> String
Expand description

Returns body truncated to at most max_chars UTF-8 characters, with an explicit "... (truncated)" suffix appended if truncation occurred.

Used when surfacing server response bodies in error variants — a server that returns a 5 MB HTML error page should not flood the logs.