diff options
author | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-03-08 16:07:54 +0000 |
---|---|---|
committer | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-03-08 16:07:54 +0000 |
commit | 0f7b26ab4e2922e767d730084cc29f713e05d126 (patch) | |
tree | bf2ed891adbbcf472ea49ef24bc26d13508b1acc /test/net/http/test_http_request.rb | |
parent | 897af5dfcdc13bc98d2372097a53483d712c8d45 (diff) |
Raise ArgumentError if host component is nil
From: oss92 <[email protected]>
fix https://github.com/ruby/ruby/pull/1278
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62698 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/net/http/test_http_request.rb')
-rw-r--r-- | test/net/http/test_http_request.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/test/net/http/test_http_request.rb b/test/net/http/test_http_request.rb index c2144d86c7..b7515b7e98 100644 --- a/test/net/http/test_http_request.rb +++ b/test/net/http/test_http_request.rb @@ -65,6 +65,18 @@ class HTTPRequestTest < Test::Unit::TestCase 'Bug #7381 - do not decode content if the user overrides' end if Net::HTTP::HAVE_ZLIB + def test_initialize_GET_uri + req = Net::HTTP::Get.new(URI("http://example.com/foo")) + assert_equal "/foo", req.path + assert_equal "example.com", req['Host'] + + req = Net::HTTP::Get.new(URI("https://example.com/foo")) + assert_equal "/foo", req.path + assert_equal "example.com", req['Host'] + + assert_raise(ArgumentError){ Net::HTTP::Get.new(URI("urn:ietf:rfc:7231")) } + end + def test_header_set req = Net::HTTP::Get.new '/' |