diff options
Diffstat (limited to 'test/net')
-rw-r--r-- | test/net/http/test_httpheader.rb | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/test/net/http/test_httpheader.rb b/test/net/http/test_httpheader.rb index 1a8751e28c..3d5fa141ef 100644 --- a/test/net/http/test_httpheader.rb +++ b/test/net/http/test_httpheader.rb @@ -7,7 +7,9 @@ class HTTPHeaderTest < Test::Unit::TestCase include Net::HTTPHeader def initialize @header = {} + @body = nil end + attr_accessor :body end def setup @@ -203,6 +205,26 @@ class HTTPHeaderTest < Test::Unit::TestCase def test_set_content_type end + def test_form_data= + @c.form_data = {"cmd"=>"search", "q"=>"ruby", "max"=>"50"} + assert_equal 'application/x-www-form-urlencoded', @c.content_type + assert_equal %w( cmd=search max=50 q=ruby ), @c.body.split('&').sort + end + + def test_set_form_data + @c.set_form_data "cmd"=>"search", "q"=>"ruby", "max"=>"50" + assert_equal 'application/x-www-form-urlencoded', @c.content_type + assert_equal %w( cmd=search max=50 q=ruby ), @c.body.split('&').sort + + @c.set_form_data "cmd"=>"search", "q"=>"ruby", "max"=>50 + assert_equal 'application/x-www-form-urlencoded', @c.content_type + assert_equal %w( cmd=search max=50 q=ruby ), @c.body.split('&').sort + + @c.set_form_data({"cmd"=>"search", "q"=>"ruby", "max"=>"50"}, ';') + assert_equal 'application/x-www-form-urlencoded', @c.content_type + assert_equal %w( cmd=search max=50 q=ruby ), @c.body.split(';').sort + end + def test_basic_auth end |