Skip to main content

validate_payload_size

Function validate_payload_size 

Source
pub fn validate_payload_size(
    payload: &Value,
    max_size_bytes: usize,
) -> Result<(), ValidationError>
Expand description

Validate that the serialized payload does not exceed max_size_bytes.

Serializing to a string to measure size is slightly wasteful, but it’s the most accurate way to measure the actual byte count of the JSON.