限流
限流:一个真实的固定窗口限流器(每个客户端每 60 秒 5 个请求),用于测试 429 和 Retry-After 的处理。客户端通过 X-Client-Id 请求头识别,没有时按 IP 识别。
你的账号已解锁这些端点。在每个端点的页面上用 Try it 发送请求。
- GET
https://api.testingapis.com/api/RateLimitMake a rate-limited request that counts toward the limitMake a rate-limited request that counts toward the limit. - POST
https://api.testingapis.com/api/RateLimit/resetReset the caller's windowReset the caller's window. - GET
https://api.testingapis.com/api/RateLimit/statusShow the caller's current window without counting a requestShow the caller's current window without counting a request.
请求示例
Make a rate-limited request that counts toward the limit. 完整参考和 Send 按钮(英文).
cURL
curl -X GET "https://api.testingapis.com/api/RateLimit" \
-H "X-Client-Id: docs-demo"响应 · 200 OK
{
"message": "Request allowed.",
"clientId": "id:docs-demo",
"used": 1,
"remaining": 4,
"limit": 5,
"windowSeconds": 60
}