diff --git a/lib/rack/attack.rb b/lib/rack/attack.rb index e51550b..77a9b53 100644 --- a/lib/rack/attack.rb +++ b/lib/rack/attack.rb @@ -35,7 +35,7 @@ module Rack::Attack @blacklisted_response ||= lambda {|env| [503, {}, ['Blocked']] } @throttled_response ||= lambda {|env| retry_after = env['rack.attack.match_data'][:period] rescue nil - [503, {'Retry-After' => retry_after}, ['Retry later']] + [503, {'Retry-After' => retry_after.to_s}, ['Retry later']] } self diff --git a/spec/rack_attack_spec.rb b/spec/rack_attack_spec.rb index 9a68bfc..8a56f98 100644 --- a/spec/rack_attack_spec.rb +++ b/spec/rack_attack_spec.rb @@ -93,7 +93,7 @@ describe 'Rack::Attack' do last_request.env['rack.attack.match_data'].must_equal({:count => 2, :limit => 1, :period => 1}) end it 'should set a Retry-After header' do - last_response.headers['Retry-After'].must_equal 1 + last_response.headers['Retry-After'].must_equal '1' end end