[ $_[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/');
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' ]