X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Fpost.t;h=54e21c6fedf3003548de17ab6b76324b8bc0c5be;hb=4061606f304b183818e175a780c87c5612a5a0ed;hp=24d608628bed7cd9daf12af5487c16338a5fe59e;hpb=a23df04cdc5adfada31489ac471b357c18dbfebf;p=catagits%2FWeb-Simple.git diff --git a/t/post.t b/t/post.t index 24d6086..54e21c6 100644 --- a/t/post.t +++ b/t/post.t @@ -20,19 +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; - my $response = test_psgi($app->to_psgi_app, sub { shift->($request) }); - return $response; -} +sub run_request { $app->run_test_request(@_); } my $get = run_request(GET 'http://localhost/'); @@ -73,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' ]