mirror of
https://github.com/samsonjs/rack-attack.git
synced 2026-03-25 09:25:49 +00:00
Change response body to 'Forbidden'
This commit is contained in:
parent
355a6fbce6
commit
1095f85242
2 changed files with 2 additions and 1 deletions
|
|
@ -40,7 +40,7 @@ module Rack::Attack
|
|||
|
||||
# Set defaults
|
||||
@notifier ||= ActiveSupport::Notifications if defined?(ActiveSupport::Notifications)
|
||||
@blacklisted_response ||= lambda {|env| [403, {}, ["Unauthorized\n"]] }
|
||||
@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"]]
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ describe 'Rack::Attack' do
|
|||
it "should return a blacklist response" do
|
||||
get '/', {}, 'REMOTE_ADDR' => @bad_ip
|
||||
last_response.status.must_equal 403
|
||||
last_response.body.must_equal "Forbidden\n"
|
||||
end
|
||||
it "should tag the env" do
|
||||
last_request.env['rack.attack.matched'].must_equal "ip #{@bad_ip}"
|
||||
|
|
|
|||
Loading…
Reference in a new issue