@@ -442,7 +442,11 @@ def test_get2
442
442
def test_post
443
443
start { |http |
444
444
_test_post__base http
445
+ }
446
+ start { |http |
445
447
_test_post__file http
448
+ }
449
+ start { |http |
446
450
_test_post__no_data http
447
451
}
448
452
end
@@ -629,10 +633,12 @@ def test_request
629
633
# _test_request__range http # WEBrick does not support Range: header.
630
634
_test_request__HEAD http
631
635
_test_request__POST http
632
- _test_request__stream_body http
633
636
_test_request__uri http
634
637
_test_request__uri_host http
635
638
}
639
+ start { |http |
640
+ _test_request__stream_body http
641
+ }
636
642
end
637
643
638
644
def _test_request__GET ( http )
@@ -843,7 +849,13 @@ def test_set_form
843
849
__EOM__
844
850
start { |http |
845
851
_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 } )
846
855
_test_set_form_multipart ( http , false , data , expected )
856
+ }
857
+ start { |http |
858
+ @server . mount ( '/' , lambda { |req , res | res . body = req . body } )
847
859
_test_set_form_multipart ( http , true , data , expected )
848
860
}
849
861
}
@@ -887,6 +899,7 @@ def test_set_form_with_file
887
899
expected . sub! ( /<filename>/ , filename )
888
900
expected . sub! ( /<data>/ , $test_net_http_data)
889
901
start { |http |
902
+ @server . mount ( '/' , lambda { |req , res | res . body = req . body } )
890
903
data . each { |k , v |v . rewind rescue nil }
891
904
req = Net ::HTTP ::Post . new ( '/' )
892
905
req . set_form ( data , 'multipart/form-data' )
@@ -902,10 +915,11 @@ def test_set_form_with_file
902
915
header )
903
916
assert_equal ( expected , body )
904
917
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)
909
923
}
910
924
}
911
925
end
@@ -984,7 +998,7 @@ def logfile
984
998
end
985
999
986
1000
def mount_proc ( &block )
987
- @server . mount ( '/continue' , WEBrick :: HTTPServlet :: ProcHandler . new ( block . to_proc ) )
1001
+ @server . mount ( '/continue' , block . to_proc )
988
1002
end
989
1003
990
1004
def test_expect_continue
@@ -1039,7 +1053,7 @@ def test_expect_continue_error
1039
1053
def test_expect_continue_error_before_body
1040
1054
@log_tester = nil
1041
1055
mount_proc { |req , res |
1042
- raise WEBrick :: HTTPStatus ::Forbidden
1056
+ raise TestNetHTTPUtils ::Forbidden
1043
1057
}
1044
1058
start { |http |
1045
1059
uheader = { 'content-type' => 'application/x-www-form-urlencoded' , 'content-length' => '5' , 'expect' => '100-continue' }
@@ -1084,7 +1098,7 @@ def logfile
1084
1098
end
1085
1099
1086
1100
def mount_proc ( &block )
1087
- @server . mount ( '/continue' , WEBrick :: HTTPServlet :: ProcHandler . new ( block . to_proc ) )
1101
+ @server . mount ( '/continue' , block . to_proc )
1088
1102
end
1089
1103
1090
1104
def test_info
@@ -1159,11 +1173,11 @@ def test_keep_alive_get_auto_retry
1159
1173
end
1160
1174
1161
1175
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:
1163
1177
#
1164
1178
# "[2021-04-29 20:36:46] DEBUG accept: 127.0.0.1:50674\n"
1165
1179
@log_tester = nil
1166
- @server . logger . level = WEBrick :: BasicLog :: DEBUG
1180
+ @logger_level = :debug
1167
1181
1168
1182
start { |http |
1169
1183
res = http . get ( '/' )
0 commit comments