summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog6
-rw-r--r--lib/net/http/header.rb2
-rw-r--r--test/net/http/test_httpheader.rb8
3 files changed, 15 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 88f9bac0f9..0843112342 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+Sun Feb 8 20:09:37 2015 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
+
+ * lib/net/http/header.rb: pass header names as symbols.
+ Patch by @DamirSvrtan [fix GH-805]
+ * test/net/http/test_httpheader.rb: added test.
+
Sun Feb 8 13:04:25 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
* ext/socket/getaddrinfo.c (get_addr): reject too long hostname to
diff --git a/lib/net/http/header.rb b/lib/net/http/header.rb
index 912419df55..8afa32a422 100644
--- a/lib/net/http/header.rb
+++ b/lib/net/http/header.rb
@@ -169,7 +169,7 @@ module Net::HTTPHeader
alias canonical_each each_capitalized
def capitalize(name)
- name.split(/-/).map {|s| s.capitalize }.join('-')
+ name.to_s.split(/-/).map {|s| s.capitalize }.join('-')
end
private :capitalize
diff --git a/test/net/http/test_httpheader.rb b/test/net/http/test_httpheader.rb
index 062387189d..224d8bb9a9 100644
--- a/test/net/http/test_httpheader.rb
+++ b/test/net/http/test_httpheader.rb
@@ -142,6 +142,14 @@ class HTTPHeaderTest < Test::Unit::TestCase
end
end
+ def test_each_capitalized_with_symbol
+ @c[:my_header] = ['a', 'b']
+ @c.each_capitalized do |k,v|
+ assert_equal "My_header", k
+ assert_equal 'a, b', v
+ end
+ end
+
def test_key?
@c['My-Header'] = 'test'
assert_equal true, @c.key?('My-Header')