1use strict; 2use warnings FATAL => 'all'; 3 4use Apache::Test; 5 6use Apache::TestUtil; 7use Apache::TestRequest qw(GET_BODY UPLOAD_BODY); 8 9plan tests => 18, need_lwp; 10 11my $module = 'TestApReq::request'; 12my $location = Apache::TestRequest::module2url($module); 13 14#print GET_BODY $location; 15 16{ 17 # basic param() test 18 my $test = 'param'; 19 my $value = '42.5'; 20 ok t_cmp(GET_BODY("$location?test=$test&value=$value"), 21 $value, 22 "basic param"); 23} 24 25 26for my $test (qw/slurp bb tempname link fh io bad;query=string%%/) { 27 # upload a string as a file 28 my $value = ('DataUpload' x 10 . "\n") x 1_000; 29 my $result = UPLOAD_BODY("$location?test=$test", content => $value); 30 ok t_cmp($result, $value, "basic upload"); 31 my $i; 32 for ($i = 0; $i < length $value; ++$i) { 33 last if substr($value,$i,1) ne substr($result,$i,1); 34 } 35 36 ok t_cmp($i, length($value), "basic upload length"); 37} 38 39 40{ 41 my $value = 'DataUpload' x 100; 42 my $result = UPLOAD_BODY("$location?test=type", content => $value); 43 ok t_cmp($result, "text/plain", "type"); 44} 45 46{ 47 my $value = 'DataUpload' x 100; 48 my $result = UPLOAD_BODY("$location?test=hook", content => $value); 49 ok t_cmp($result, $value, "hook"); 50} 51 52{ 53 my $value = 'DataUpload' x 100; 54 my $result = UPLOAD_BODY("$location?test=disable_uploads;foo=bar1;foo=bar2", 55 content => $value); 56 ok t_cmp($result, "ok", "disabled uploads"); 57} 58