mirror of
https://github.com/samsonjs/rack-attack.git
synced 2026-03-25 09:25:49 +00:00
Tidy up defaults. We don't need to use ||= because this runs when the class gets loaded, and we won't have user supplied defaults yet.
This commit is contained in:
parent
332dd4ff9e
commit
93421efa5a
1 changed files with 3 additions and 3 deletions
|
|
@ -76,9 +76,9 @@ class Rack::Attack
|
|||
end
|
||||
|
||||
# Set defaults
|
||||
@notifier ||= ActiveSupport::Notifications if defined?(ActiveSupport::Notifications)
|
||||
@blacklisted_response ||= lambda {|env| [403, {}, ["Forbidden\n"]] }
|
||||
@throttled_response ||= lambda {|env|
|
||||
@notifier = ActiveSupport::Notifications if defined?(ActiveSupport::Notifications)
|
||||
@blacklisted_response = lambda {|env| [403, {}, ["Forbidden\n"]] }
|
||||
@throttled_response = lambda {|env|
|
||||
retry_after = env['rack.attack.match_data'][:period] rescue nil
|
||||
[429, {'Retry-After' => retry_after.to_s}, ["Retry later\n"]]
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue