pub async fn write_rate_limit_error(
session: &mut Session,
status: u16,
body: &str,
limit: u32,
remaining: u32,
reset_at: u64,
retry_after: u64,
) -> Result<(), Box<Error>>Expand description
Write a rate limit error response with standard rate limit headers
Includes the following headers:
X-RateLimit-Limit: Maximum requests per windowX-RateLimit-Remaining: Remaining requests in current windowX-RateLimit-Reset: Unix timestamp when the window resetsRetry-After: Seconds until the client should retry (for 429 responses)
ยงArguments
session- The Pingora session to write tostatus- HTTP status code (typically 429)body- Response body as stringlimit- Maximum requests allowed per windowremaining- Remaining requests in current windowreset_at- Unix timestamp when the window resetsretry_after- Seconds until client should retry