@@ -303,6 +303,13 @@ def test_s_get
303303 assert_equal $test_net_http_data,
304304 Net ::HTTP . get ( config ( 'host' ) , '/' , config ( 'port' ) )
305305
306+ assert_equal $test_net_http_data,
307+ Net ::HTTP . get ( "http://#{ config ( 'host' ) } :#{ config ( 'port' ) } " )
308+
309+ assert_equal $test_net_http_data, Net ::HTTP . get (
310+ "http://#{ config ( 'host' ) } :#{ config ( 'port' ) } " , "Accept" => "text/plain"
311+ )
312+
306313 assert_equal $test_net_http_data, Net ::HTTP . get (
307314 URI . parse ( "http://#{ config ( 'host' ) } :#{ config ( 'port' ) } " )
308315 )
@@ -311,7 +318,23 @@ def test_s_get
311318 )
312319 end
313320
314- def test_s_get_response
321+ def test_s_get_response_with_host
322+ res = Net ::HTTP . get_response ( config ( 'host' ) , '/' , config ( 'port' ) )
323+ assert_equal "application/octet-stream" , res [ "Content-Type" ]
324+ assert_equal $test_net_http_data, res . body
325+ end
326+
327+ def test_s_get_response_with_uri_string
328+ res = Net ::HTTP . get_response ( "http://#{ config ( 'host' ) } :#{ config ( 'port' ) } " )
329+ assert_equal "application/octet-stream" , res [ "Content-Type" ]
330+ assert_equal $test_net_http_data, res . body
331+
332+ res = Net ::HTTP . get_response ( "http://#{ config ( 'host' ) } :#{ config ( 'port' ) } " , "Accept" => "text/plain" )
333+ assert_equal "text/plain" , res [ "Content-Type" ]
334+ assert_equal $test_net_http_data, res . body
335+ end
336+
337+ def test_s_get_response_with_uri
315338 res = Net ::HTTP . get_response (
316339 URI . parse ( "http://#{ config ( 'host' ) } :#{ config ( 'port' ) } " )
317340 )
0 commit comments