summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoraamine <aamine@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2005-01-01 08:45:50 +0000
committeraamine <aamine@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2005-01-01 08:45:50 +0000
commit1fc6aaccf3ce48af021f910e67392392a77055bc (patch)
tree3ebce2e64a3ebc80fb64f4b83e05169f6606f304
parent92c27297c6245f6479465ae84e200fc4f16db1c8 (diff)
downloadruby-1fc6aaccf3ce48af021f910e67392392a77055bc.tar.gz
ruby-1fc6aaccf3ce48af021f910e67392392a77055bc.tar.xz
ruby-1fc6aaccf3ce48af021f910e67392392a77055bc.zip
* 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. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@7701 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog7
-rw-r--r--lib/net/http.rb2
-rw-r--r--test/net/http/test_httpheader.rb8
3 files changed, 16 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 30174de82..fd1d865e7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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