]> cat aescling's git repositories - mastodon.git/commitdiff
Add Content-Type header on throttled response to fix mojibake (#4558)
authorunarist <m.unarist@gmail.com>
Tue, 8 Aug 2017 13:47:35 +0000 (22:47 +0900)
committerEugen Rochko <eugen@zeonfederated.com>
Tue, 8 Aug 2017 13:47:35 +0000 (15:47 +0200)
application/json only allows Unicode, so this prevents from wrong charset detection.

config/initializers/rack_attack.rb

index d5cd77b3461dad7e4455ef77b38bda5a327f3d61..53cb106cac427b42687a108f588c6b68bcc73fb0 100644 (file)
@@ -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),