pub async fn rate_limit(
__arg0: State<Arc<RateLimiter>>,
request: Request<Body>,
next: Next,
) -> Result<Response<Body>, (StatusCode, [(HeaderName, HeaderValue); 1])>Expand description
Axum middleware that rejects requests with 429 when the token bucket is exhausted.
§Errors
Returns StatusCode::TOO_MANY_REQUESTS with Retry-After: 1 header when
the rate limit is exceeded.