aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/dispatch/header_test.rb
diff options
context:
space:
mode:
Diffstat (limited to 'actionpack/test/dispatch/header_test.rb')
-rw-r--r--actionpack/test/dispatch/header_test.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/actionpack/test/dispatch/header_test.rb b/actionpack/test/dispatch/header_test.rb
index 79600b654b..7f1ef121b7 100644
--- a/actionpack/test/dispatch/header_test.rb
+++ b/actionpack/test/dispatch/header_test.rb
@@ -42,6 +42,24 @@ class HeaderTest < ActiveSupport::TestCase
assert_equal "127.0.0.1", @headers["HTTP_HOST"]
end
+ test "add to multivalued headers" do
+ # Sets header when not present
+ @headers.add 'Foo', '1'
+ assert_equal '1', @headers['Foo']
+
+ # Ignores nil values
+ @headers.add 'Foo', nil
+ assert_equal '1', @headers['Foo']
+
+ # Converts value to string
+ @headers.add 'Foo', 1
+ assert_equal '1,1', @headers['Foo']
+
+ # Case-insensitive
+ @headers.add 'fOo', 2
+ assert_equal '1,1,2', @headers['foO']
+ end
+
test "headers can contain numbers" do
@headers["Content-MD5"] = "Q2hlY2sgSW50ZWdyaXR5IQ=="