aboutsummaryrefslogtreecommitdiffstats
path: root/test/open-uri
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-04-09 10:53:41 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-04-09 10:53:41 +0000
commit4329b14cfbe4c91561c12ba7d1b40c66faea30b5 (patch)
tree68f671ba954347af00370146dc7174aeda67982d /test/open-uri
parent56486e00ecd02007787620e814c991f94d68ff49 (diff)
downloadruby-4329b14cfbe4c91561c12ba7d1b40c66faea30b5.tar.gz
* lib/open-uri.rb: Support multiple fields with same field
name (like Set-Cookie). (OpenURI::Meta#metas): New accessor to obtain fields as a Hash from field name (string) to field values (array of strings). [ruby-core:37734] [Bug #4964] reported by ren li. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40207 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/open-uri')
-rw-r--r--test/open-uri/test_open-uri.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/open-uri/test_open-uri.rb b/test/open-uri/test_open-uri.rb
index 740728e9e7..21dd96960a 100644
--- a/test/open-uri/test_open-uri.rb
+++ b/test/open-uri/test_open-uri.rb
@@ -502,6 +502,21 @@ class TestOpenURI < Test::Unit::TestCase
}
end if defined?(Zlib::GzipWriter)
+ def test_multiple_cookies
+ with_http {|srv, dr, url|
+ srv.mount_proc("/mcookie/") {|req, res|
+ res.cookies << "name1=value1; blabla"
+ res.cookies << "name2=value2; blabla"
+ res.body = "foo"
+ }
+ open("#{url}/mcookie/") {|f|
+ assert_equal("foo", f.read)
+ assert_equal(["name1=value1; blabla", "name2=value2; blabla"],
+ f.metas['set-cookie'].sort)
+ }
+ }
+ end
+
# 192.0.2.0/24 is TEST-NET. [RFC3330]
def test_ftp_invalid_request