diff options
author | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-01-22 08:31:38 +0000 |
---|---|---|
committer | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-01-22 08:31:38 +0000 |
commit | acdab5fd56f21471ed81fae36ac6356bd15ce869 (patch) | |
tree | 1c7f0d623ac6d9104130b7e3acea326f1f4e0607 /test | |
parent | 1ac6292dbef565b5aa5d653ca46632adf04fb1fa (diff) |
merge revision(s) 49104,49105: [Backport #10692]
* test/net/http/test_http.rb (_test_send_request__HEAD): Added
failing test for send_request with HEAD method.
* lib/net/http.rb (Net::HTTP#send_request): there is no response body
with HEAD request. Patch by @rodrigosaito [fix GH-520]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_0_0@49378 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r-- | test/net/http/test_http.rb | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/test/net/http/test_http.rb b/test/net/http/test_http.rb index 0a0b6ca809..527b7b6f05 100644 --- a/test/net/http/test_http.rb +++ b/test/net/http/test_http.rb @@ -574,6 +574,7 @@ module TestNetHTTP_version_1_2_methods def test_send_request start {|http| _test_send_request__GET http + _test_send_request__HEAD http _test_send_request__POST http } end @@ -588,6 +589,16 @@ module TestNetHTTP_version_1_2_methods assert_equal $test_net_http_data, res.body end + def _test_send_request__HEAD(http) + res = http.send_request('HEAD', '/') + assert_kind_of Net::HTTPResponse, res + unless self.is_a?(TestNetHTTP_v1_2_chunked) + assert_not_nil res['content-length'] + assert_equal $test_net_http_data.size, res['content-length'].to_i + end + assert_nil res.body + end + def _test_send_request__POST(http) data = 'aaabbb cc ddddddddddd lkjoiu4j3qlkuoa' res = http.send_request('POST', '/', data, 'content-type' => 'application/x-www-form-urlencoded') |