about summary refs log tree commit diff
diff options
context:
space:
mode:
authorunarist <m.unarist@gmail.com>2017-08-08 22:47:35 +0900
committerEugen Rochko <eugen@zeonfederated.com>2017-08-08 15:47:35 +0200
commitb42c018bb8f86e27af43d84bf558d669e18def3b (patch)
treef64ffcde43458b11ac724b0e86c780438313134b
parentc9fd6f386c5ae0938f1f9c2d1134508e66231e23 (diff)
Add Content-Type header on throttled response to fix mojibake (#4558)
application/json only allows Unicode, so this prevents from wrong charset detection.
-rw-r--r--config/initializers/rack_attack.rb1
1 files changed, 1 insertions, 0 deletions
diff --git a/config/initializers/rack_attack.rb b/config/initializers/rack_attack.rb
index d5cd77b34..53cb106ca 100644
--- a/config/initializers/rack_attack.rb
+++ b/config/initializers/rack_attack.rb
@@ -33,6 +33,7 @@ class Rack::Attack
     match_data = env['rack.attack.match_data']
 
     headers = {
+      'Content-Type'          => 'application/json',
       'X-RateLimit-Limit'     => match_data[:limit].to_s,
       'X-RateLimit-Remaining' => '0',
       'X-RateLimit-Reset'     => (now + (match_data[:period] - now.to_i % match_data[:period])).iso8601(6),