more edgy ratelimits

This commit is contained in:
Ole-Morten Duesund 2025-05-13 20:00:18 +02:00
commit 467caa404d

8
app.rb
View file

@ -110,9 +110,13 @@ end
get '/' do get '/' do
if rate_limited? 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 content_type :json
return { error: "Too Many Requests" }.to_json return { error: response[:message] }.to_json
end end
lang = preferred_language lang = preferred_language