Change response body to 'Forbidden'

This commit is contained in:
Carsten Zimmermann 2014-02-06 23:29:44 +01:00
parent 355a6fbce6
commit 1095f85242
2 changed files with 2 additions and 1 deletions

View file

@ -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"]]

View file

@ -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}"