diff options
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | lib/net/http.rb | 2 | ||||
-rw-r--r-- | test/net/http/test_httpheader.rb | 8 |
3 files changed, 16 insertions, 1 deletions
@@ -1,3 +1,10 @@ +Sat Jan 1 17:44:54 2005 Minero Aoki <aamine@loveruby.net> + + * lib/net/http.rb (each_capitalized): should join header field + value. This patch is contributed sheepman [ruby-list:40478] + + * test/net/http/test_httpheader.rb: test it. + Sat Jan 1 16:21:29 2005 Minero Aoki <aamine@loveruby.net> * lib/fileutils.rb (copy_stream): use read/write instead of diff --git a/lib/net/http.rb b/lib/net/http.rb index dc6256f11..f7bf37c02 100644 --- a/lib/net/http.rb +++ b/lib/net/http.rb @@ -1138,7 +1138,7 @@ module Net # :nodoc: # As for #each_header, except the keys are provided in capitalized form. def each_capitalized @header.each do |k,v| - yield capitalize(k), v + yield capitalize(k), v.join(', ') end end diff --git a/test/net/http/test_httpheader.rb b/test/net/http/test_httpheader.rb index 4a133b44d..1a8751e28 100644 --- a/test/net/http/test_httpheader.rb +++ b/test/net/http/test_httpheader.rb @@ -68,6 +68,14 @@ class HTTPHeaderTest < Test::Unit::TestCase def test_each_value end + def test_each_capitalized + @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? end |