From ca97ec509955d70bde47d337e5086920f0c79b63 Mon Sep 17 00:00:00 2001 From: schneems Date: Wed, 7 May 2014 12:01:34 -0500 Subject: HTTP::Headers#key? correctly converts Previously if you were looking for a given key, the header may incorrectly tell you that it did not exist even though it would return a valid value: ```ruby env = { "CONTENT_TYPE" => "text/plain" } headers = ActionDispatch::Http::Headers.new(env) headers["Content-Type"] # => "text/plain" headers.key?("Content-Type") # => false ``` This PR fixes that behavior by converting the key before checking for presence --- actionpack/test/dispatch/header_test.rb | 2 ++ 1 file changed, 2 insertions(+) (limited to 'actionpack/test/dispatch/header_test.rb') diff --git a/actionpack/test/dispatch/header_test.rb b/actionpack/test/dispatch/header_test.rb index 9e37b96951..e2b38c23bc 100644 --- a/actionpack/test/dispatch/header_test.rb +++ b/actionpack/test/dispatch/header_test.rb @@ -55,6 +55,8 @@ class HeaderTest < ActiveSupport::TestCase test "key?" do assert @headers.key?("CONTENT_TYPE") assert @headers.include?("CONTENT_TYPE") + assert @headers.key?("Content-Type") + assert @headers.include?("Content-Type") end test "fetch with block" do -- cgit v1.2.3