Skip to main content

rate_limit

Function rate_limit 

Source
pub async fn rate_limit(
    registry: Arc<RateLimitRegistry>,
    request: Request,
    next: Next,
) -> Response
Expand description

Per-client (per-API-key) rate-limit middleware (Issue 51).

Anonymous requests pass through — they hit the auth handler and get a 401 instead. Authenticated requests check the registry’s bucket for the caller’s key and are rejected with HTTP 429 when drained. Detail about retry-after is intentionally omitted from the public body; the log line carries the key fingerprint for operators.