X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Fpost.t;h=54e21c6fedf3003548de17ab6b76324b8bc0c5be;hb=run_if_script_error;hp=805e57bdb4cfb76e5ee46c3921332182b43feeec;hpb=30e2c525d12f6b82eb3350583cabfc9dda8c5ae3;p=catagits%2FWeb-Simple.git diff --git a/t/post.t b/t/post.t index 805e57b..54e21c6 100644 --- a/t/post.t +++ b/t/post.t @@ -20,18 +20,20 @@ use Test::More qw(no_plan); [ $_[1]->reason || $_[1]->filename ], ] }, + sub (POST + %* + %biff=) { + $_[1]->{bar} ||= 'EMPTY'; + [ 200, + [ "Content-type" => "text/plain" ], + [ join(' ',@{$_[1]}{qw(biff bong)}) ] + ] + }, } } -use Plack::Test; use HTTP::Request::Common qw(GET POST); my $app = PostTest->new; - -sub run_request { - my $request = shift; - return test_psgi $app->to_psgi_app, sub { shift->($request) }; -} +sub run_request { $app->run_test_request(@_); } my $get = run_request(GET 'http://localhost/'); @@ -72,6 +74,19 @@ cmp_ok($upload->code, '==', 200, '200 with multipart'); is($upload->content, 'FOO BAR', 'both params returned'); +my $upload_splat = run_request( + POST 'http://localhost' + => Content_Type => 'form-data' + => Content => [ + biff => 'frew', + bong => 'fru' + ] +); + +cmp_ok($upload_splat->code, '==', 200, '200 with multipart'); + +is($upload_splat->content, 'frew fru', 'both params returned'); + my $upload_wrongtype = run_request( POST 'http://localhost' => [ baz => 'fleem' ]