Skip to main content

quota_from_body

Function quota_from_body 

Source
fn quota_from_body(
    body: &[u8],
    key: &str,
) -> Result<QuotaLimitData, OauthUsageError>
Expand description

Parse a Z.ai monitor body. The HTTP layer carries no verdict - a wrong key and a wrong path arrive as HTTP 200 - so the envelope is decoded unconditionally and keyed on success/code. A body-level 401 (wrong key) surfaces as OauthUsageError::Unauthorized so it bails the boot probe like a real auth rejection; every other failure keeps the envelope’s msg.

Every string here reaches a log through ProbeError’s Display, so the body it quotes is masked the way the log fields are: a reflecting host lands the key in msg or in a serde message.