@@ -442,7 +442,11 @@ def test_get2
442442 def test_post
443443 start { |http |
444444 _test_post__base http
445+ }
446+ start { |http |
445447 _test_post__file http
448+ }
449+ start { |http |
446450 _test_post__no_data http
447451 }
448452 end
@@ -629,10 +633,12 @@ def test_request
629633 # _test_request__range http # WEBrick does not support Range: header.
630634 _test_request__HEAD http
631635 _test_request__POST http
632- _test_request__stream_body http
633636 _test_request__uri http
634637 _test_request__uri_host http
635638 }
639+ start { |http |
640+ _test_request__stream_body http
641+ }
636642 end
637643
638644 def _test_request__GET ( http )
@@ -843,7 +849,13 @@ def test_set_form
843849__EOM__
844850 start { |http |
845851 _test_set_form_urlencoded ( http , data . reject { |k , v |!v . is_a? ( String ) } )
852+ }
853+ start { |http |
854+ @server . mount ( '/' , lambda { |req , res | res . body = req . body } )
846855 _test_set_form_multipart ( http , false , data , expected )
856+ }
857+ start { |http |
858+ @server . mount ( '/' , lambda { |req , res | res . body = req . body } )
847859 _test_set_form_multipart ( http , true , data , expected )
848860 }
849861 }
@@ -887,6 +899,7 @@ def test_set_form_with_file
887899 expected . sub! ( /<filename>/ , filename )
888900 expected . sub! ( /<data>/ , $test_net_http_data)
889901 start { |http |
902+ @server . mount ( '/' , lambda { |req , res | res . body = req . body } )
890903 data . each { |k , v |v . rewind rescue nil }
891904 req = Net ::HTTP ::Post . new ( '/' )
892905 req . set_form ( data , 'multipart/form-data' )
@@ -902,10 +915,11 @@ def test_set_form_with_file
902915 header )
903916 assert_equal ( expected , body )
904917
905- data . each { |k , v |v . rewind rescue nil }
906- req [ 'Transfer-Encoding' ] = 'chunked'
907- res = http . request req
908- #assert_equal(expected, res.body)
918+ # TODO: test with chunked
919+ # data.each{|k,v|v.rewind rescue nil}
920+ # req['Transfer-Encoding'] = 'chunked'
921+ # res = http.request req
922+ # assert_equal(expected, res.body)
909923 }
910924 }
911925 end
@@ -984,7 +998,7 @@ def logfile
984998 end
985999
9861000 def mount_proc ( &block )
987- @server . mount ( '/continue' , WEBrick :: HTTPServlet :: ProcHandler . new ( block . to_proc ) )
1001+ @server . mount ( '/continue' , block . to_proc )
9881002 end
9891003
9901004 def test_expect_continue
@@ -1039,7 +1053,7 @@ def test_expect_continue_error
10391053 def test_expect_continue_error_before_body
10401054 @log_tester = nil
10411055 mount_proc { |req , res |
1042- raise WEBrick :: HTTPStatus ::Forbidden
1056+ raise TestNetHTTPUtils ::Forbidden
10431057 }
10441058 start { |http |
10451059 uheader = { 'content-type' => 'application/x-www-form-urlencoded' , 'content-length' => '5' , 'expect' => '100-continue' }
@@ -1084,7 +1098,7 @@ def logfile
10841098 end
10851099
10861100 def mount_proc ( &block )
1087- @server . mount ( '/continue' , WEBrick :: HTTPServlet :: ProcHandler . new ( block . to_proc ) )
1101+ @server . mount ( '/continue' , block . to_proc )
10881102 end
10891103
10901104 def test_info
@@ -1159,11 +1173,11 @@ def test_keep_alive_get_auto_retry
11591173 end
11601174
11611175 def test_keep_alive_reset_on_new_connection
1162- # Using WEBrick's debug log output on accepting connection:
1176+ # Using debug log output on accepting connection:
11631177 #
11641178 # "[2021-04-29 20:36:46] DEBUG accept: 127.0.0.1:50674\n"
11651179 @log_tester = nil
1166- @server . logger . level = WEBrick :: BasicLog :: DEBUG
1180+ @logger_level = :debug
11671181
11681182 start { |http |
11691183 res = http . get ( '/' )
0 commit comments