mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Fix header capitalization by explicitly upcasing first letter of every word, and avoiding capitalize. [#5636 state:resolved]
This commit is contained in:
parent
154081f0f7
commit
20685d07ab
2 changed files with 12 additions and 1 deletions
|
@ -22,7 +22,7 @@ module ActionController
|
|||
location = options.delete(:location)
|
||||
|
||||
options.each do |key, value|
|
||||
headers[key.to_s.dasherize.split(/-/).map { |v| v.capitalize }.join("-")] = value.to_s
|
||||
headers[key.to_s.dasherize.split('-').each { |v| v[0] = v[0].chr.upcase }.join('-')] = value.to_s
|
||||
end
|
||||
|
||||
self.status = status
|
||||
|
|
|
@ -488,6 +488,10 @@ class TestController < ActionController::Base
|
|||
head :x_custom_header => "something"
|
||||
end
|
||||
|
||||
def head_with_www_authenticate_header
|
||||
head 'WWW-Authenticate' => 'something'
|
||||
end
|
||||
|
||||
def head_with_status_code_first
|
||||
head :forbidden, :x_custom_header => "something"
|
||||
end
|
||||
|
@ -1139,6 +1143,13 @@ class RenderTest < ActionController::TestCase
|
|||
assert_response :ok
|
||||
end
|
||||
|
||||
def test_head_with_www_authenticate_header
|
||||
get :head_with_www_authenticate_header
|
||||
assert_blank @response.body
|
||||
assert_equal "something", @response.headers["WWW-Authenticate"]
|
||||
assert_response :ok
|
||||
end
|
||||
|
||||
def test_head_with_symbolic_status
|
||||
get :head_with_symbolic_status, :status => "ok"
|
||||
assert_equal 200, @response.status
|
||||
|
|
Loading…
Reference in a new issue