diff options
author | aamine <aamine@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-05-12 09:25:56 +0000 |
---|---|---|
committer | aamine <aamine@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-05-12 09:25:56 +0000 |
commit | 0bf30ef7ca43d621ce3cc0ed262cdc3637425b44 (patch) | |
tree | 39cb3670513b985e87080581925b4019501e5169 /test/net/http | |
parent | d8f7f55170225d8a28989e9714f449a54c04a3ee (diff) | |
download | ruby-0bf30ef7ca43d621ce3cc0ed262cdc3637425b44.tar.gz ruby-0bf30ef7ca43d621ce3cc0ed262cdc3637425b44.tar.xz ruby-0bf30ef7ca43d621ce3cc0ed262cdc3637425b44.zip |
* lib/net/http.rb (tokens): forgot to add strip. [ruby-core:11120]
* test/net/http/test_http.rb: test Net::HTTP.post_form.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@12274 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/net/http')
-rw-r--r-- | test/net/http/test_http.rb | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/test/net/http/test_http.rb b/test/net/http/test_http.rb index 655c22a31..eeb046b54 100644 --- a/test/net/http/test_http.rb +++ b/test/net/http/test_http.rb @@ -139,6 +139,25 @@ module TestNetHTTP_version_1_1_methods assert_equal data, f.string end + def test_s_post_form + res = Net::HTTP.post_form( + URI.parse("http://#{config('host')}:#{config('port')}/"), + "a" => "x") + assert_equal ["a=x"], res.body.split(/[;&]/).sort + + res = Net::HTTP.post_form( + URI.parse("http://#{config('host')}:#{config('port')}/"), + "a" => "x", + "b" => "y") + assert_equal ["a=x", "b=y"], res.body.split(/[;&]/).sort + + res = Net::HTTP.post_form( + URI.parse("http://#{config('host')}:#{config('port')}/"), + "a" => ["x1", "x2"], + "b" => "y") + assert_equal ["a=x1", "a=x2", "b=y"], res.body.split(/[;&]/).sort + end + end @@ -312,6 +331,7 @@ module TestNetHTTPUtils res.body = $test_net_http_data end + # echo server def do_POST(req, res) res['Content-Type'] = req['Content-Type'] res.body = req.body |