FIX: rate limiter text is confusing, should not say daily

Also, adds easily parseable JSON so users can figure out
how long to wait when the API is limited. ("extras" "wait_seconds")
This commit is contained in:
Sam
2018-02-14 15:29:50 +11:00
parent 0b13b82e94
commit 38f4acd55a
3 changed files with 7 additions and 2 deletions

View File

@ -107,7 +107,7 @@ class ApplicationController < ActionController::Base
end
def render_rate_limit_error(e)
render_json_error e.description, type: :rate_limit, status: 429
render_json_error e.description, type: :rate_limit, status: 429, extras: { wait_seconds: e&.available_in }
end
# If they hit the rate limiter