more edgy ratelimits
This commit is contained in:
parent
871d8975ca
commit
467caa404d
1 changed files with 6 additions and 2 deletions
8
app.rb
8
app.rb
|
|
@ -110,9 +110,13 @@ end
|
|||
|
||||
get '/' do
|
||||
if rate_limited?
|
||||
status 429
|
||||
response = [ { status: 402, message: "I'm not paid enough for this." },
|
||||
{ status: 418, message: "I'm just a teapot."},
|
||||
{ status: 429, message: "Not so fast!"} ].sample
|
||||
|
||||
status response[:status]
|
||||
content_type :json
|
||||
return { error: "Too Many Requests" }.to_json
|
||||
return { error: response[:message] }.to_json
|
||||
end
|
||||
|
||||
lang = preferred_language
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue