Skip to content

Commit 1095f85

Browse files
committed
Change response body to 'Forbidden'
1 parent 355a6fb commit 1095f85

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

lib/rack/attack.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ def new(app)
4040

4141
# Set defaults
4242
@notifier ||= ActiveSupport::Notifications if defined?(ActiveSupport::Notifications)
43-
@blacklisted_response ||= lambda {|env| [403, {}, ["Unauthorized\n"]] }
43+
@blacklisted_response ||= lambda {|env| [403, {}, ["Forbidden\n"]] }
4444
@throttled_response ||= lambda {|env|
4545
retry_after = env['rack.attack.match_data'][:period] rescue nil
4646
[429, {'Retry-After' => retry_after.to_s}, ["Retry later\n"]]

spec/rack_attack_spec.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
it "should return a blacklist response" do
1717
get '/', {}, 'REMOTE_ADDR' => @bad_ip
1818
last_response.status.must_equal 403
19+
last_response.body.must_equal "Forbidden\n"
1920
end
2021
it "should tag the env" do
2122
last_request.env['rack.attack.matched'].must_equal "ip #{@bad_ip}"

0 commit comments

Comments
 (0)