@@ -301,6 +301,13 @@ def test_s_get
301
301
assert_equal $test_net_http_data,
302
302
Net ::HTTP . get ( config ( 'host' ) , '/' , config ( 'port' ) )
303
303
304
+ assert_equal $test_net_http_data,
305
+ Net ::HTTP . get ( "http://#{ config ( 'host' ) } :#{ config ( 'port' ) } " )
306
+
307
+ assert_equal $test_net_http_data, Net ::HTTP . get (
308
+ "http://#{ config ( 'host' ) } :#{ config ( 'port' ) } " , "Accept" => "text/plain"
309
+ )
310
+
304
311
assert_equal $test_net_http_data, Net ::HTTP . get (
305
312
URI . parse ( "http://#{ config ( 'host' ) } :#{ config ( 'port' ) } " )
306
313
)
@@ -309,7 +316,23 @@ def test_s_get
309
316
)
310
317
end
311
318
312
- def test_s_get_response
319
+ def test_s_get_response_with_host
320
+ res = Net ::HTTP . get_response ( config ( 'host' ) , '/' , config ( 'port' ) )
321
+ assert_equal "application/octet-stream" , res [ "Content-Type" ]
322
+ assert_equal $test_net_http_data, res . body
323
+ end
324
+
325
+ def test_s_get_response_with_uri_string
326
+ res = Net ::HTTP . get_response ( "http://#{ config ( 'host' ) } :#{ config ( 'port' ) } " )
327
+ assert_equal "application/octet-stream" , res [ "Content-Type" ]
328
+ assert_equal $test_net_http_data, res . body
329
+
330
+ res = Net ::HTTP . get_response ( "http://#{ config ( 'host' ) } :#{ config ( 'port' ) } " , "Accept" => "text/plain" )
331
+ assert_equal "text/plain" , res [ "Content-Type" ]
332
+ assert_equal $test_net_http_data, res . body
333
+ end
334
+
335
+ def test_s_get_response_with_uri
313
336
res = Net ::HTTP . get_response (
314
337
URI . parse ( "http://#{ config ( 'host' ) } :#{ config ( 'port' ) } " )
315
338
)
0 commit comments