Skip to main content

stamp_error_ids_in_bytes

Function stamp_error_ids_in_bytes 

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

Byte-oriented stamp_error_ids: parse body as JSON, stamp missing errors[].id with id, and re-serialize.

Returns the input unchanged (a borrowed Cow) when the body is not JSON, is not an errors document, or already carries an id on every member — so it is a safe no-op on non-error and non-JSON bodies.