pub fn maybe_compress(payload: &[u8]) -> BytesExpand description
Compress a payload if it exceeds the threshold.
Returns the original bytes if:
- Payload is below threshold
- Compression fails
- Compressed size is larger than original (unlikely for JSON)
Returns a compressed wrapper JSON if compression is beneficial.