Skip to main content

truncate_api_body

Function truncate_api_body 

Source
pub fn truncate_api_body(body: &str) -> String
Expand description

The ONE construction site for a capped api-call body: returns body verbatim when it fits GATEWAY_CLIENT_BODY_CAP_BYTES, otherwise its first cap bytes (on a UTF-8 char boundary) plus GATEWAY_CLIENT_BODY_TRUNCATION_MARKER. The variant always carries its final form — construction cannot forget the cap.