Function body_to_string

Source
pub fn body_to_string(body: &[u8]) -> Cow<'_, str>
Expand description

Converts a byte slice to a UTF-8 string or provides a fallback message.

  • body: The byte slice to convert.
  • Returns: A Cow<'_, str> containing the UTF-8 string if valid, otherwise an owned string indicating the binary data length.