summaryrefslogtreecommitdiff
path: root/test/net
diff options
context:
space:
mode:
authoraamine <aamine@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2006-07-26 13:00:26 +0000
committeraamine <aamine@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2006-07-26 13:00:26 +0000
commite1173b2c78ad8537da935606d61ecbc775c152b1 (patch)
treea285ff9dcbb07e75b7ad819de842850d122a2894 /test/net
parentc9500ee8d94e0ff1ac600b14998ba23bc7e743ef (diff)
* lib/net/http.rb (Net::HTTP#post, request_post, request): should set Content-Type: x-www-form-urlencoded by default.
* lib/net/http.rb (Net::HTTPHeader#content_type): should return nil when there's no Content-Type. * lib/net/http.rb (Net::HTTPHeader#sub_type): should return nil when there's no sub Content-Type (e.g. "Content-Type: text"). * lib/net/http.rb (Net::HTTPHeader#type_params): wrongly failed when there's no Content-Type. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10611 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/net')
-rw-r--r--test/net/http/test_httpheader.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/net/http/test_httpheader.rb b/test/net/http/test_httpheader.rb
index 3d5fa141ef..ca2bf9f46e 100644
--- a/test/net/http/test_httpheader.rb
+++ b/test/net/http/test_httpheader.rb
@@ -167,39 +167,51 @@ class HTTPHeaderTest < Test::Unit::TestCase
end
def test_content_type
+ assert_nil @c.content_type
@c.content_type = 'text/html'
assert_equal 'text/html', @c.content_type
@c.content_type = 'application/pdf'
assert_equal 'application/pdf', @c.content_type
@c.set_content_type 'text/html', {'charset' => 'iso-2022-jp'}
assert_equal 'text/html', @c.content_type
+ @c.content_type = 'text'
+ assert_equal 'text', @c.content_type
end
def test_main_type
+ assert_nil @c.main_type
@c.content_type = 'text/html'
assert_equal 'text', @c.main_type
@c.content_type = 'application/pdf'
assert_equal 'application', @c.main_type
@c.set_content_type 'text/html', {'charset' => 'iso-2022-jp'}
assert_equal 'text', @c.main_type
+ @c.content_type = 'text'
+ assert_equal 'text', @c.main_type
end
def test_sub_type
+ assert_nil @c.sub_type
@c.content_type = 'text/html'
assert_equal 'html', @c.sub_type
@c.content_type = 'application/pdf'
assert_equal 'pdf', @c.sub_type
@c.set_content_type 'text/html', {'charset' => 'iso-2022-jp'}
assert_equal 'html', @c.sub_type
+ @c.content_type = 'text'
+ assert_nil @c.sub_type
end
def test_type_params
+ assert_equal({}, @c.type_params)
@c.content_type = 'text/html'
assert_equal({}, @c.type_params)
@c.content_type = 'application/pdf'
assert_equal({}, @c.type_params)
@c.set_content_type 'text/html', {'charset' => 'iso-2022-jp'}
assert_equal({'charset' => 'iso-2022-jp'}, @c.type_params)
+ @c.content_type = 'text'
+ assert_equal({}, @c.type_params)
end
def test_set_content_type