Skip to content
Snippets Groups Projects
Commit b42c018b authored by unarist's avatar unarist Committed by Eugen Rochko
Browse files

Add Content-Type header on throttled response to fix mojibake (#4558)

application/json only allows Unicode, so this prevents from wrong charset detection.
parent c9fd6f38
No related branches found
No related tags found
No related merge requests found
......@@ -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),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment