missing CONTRIBUTORS entry for osfameron
[catagits/Web-Simple.git] / t / post.t
index 24d6086..54e21c6 100644 (file)
--- 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' ]