Updated and expanded test suit
[catagits/Catalyst-Runtime.git] / t / engine / request / body.t
index 03e3b03..3bc28fd 100644 (file)
@@ -6,7 +6,7 @@ use warnings;
 use FindBin;
 use lib "$FindBin::Bin/../../lib";
 
-use Test::More tests => 10;
+use Test::More tests => 20;
 use Catalyst::Test 'TestApp';
 
 use Catalyst::Request;
@@ -37,3 +37,28 @@ use HTTP::Request::Common;
     is( $creq->content_length, $request->content_length, 'Catalyst::Request Content-Length' );
     is( $creq->body, $request->content, 'Catalyst::Request Content' );
 }
+
+{
+    my $creq;
+
+    my $request = POST( 'http://localhost/dump/request/',
+        'Content-Type' => 'text/plain',
+        'Content'      => 'x' x 100_000
+    );
+
+    ok( my $response = request($request), 'Request' );
+    ok( $response->is_success, 'Response Successful 2xx' );
+    is( $response->content_type, 'text/plain', 'Response Content-Type' );
+    like( $response->content, qr/^bless\( .* 'Catalyst::Request' \)$/s, 'Content is a serialized Catalyst::Request' );
+    
+    {
+        no strict 'refs';
+        ok( eval '$creq = ' . $response->content, 'Unserialize Catalyst::Request' );
+    }
+
+    isa_ok( $creq, 'Catalyst::Request' );
+    is( $creq->method, 'POST', 'Catalyst::Request method' );
+    is( $creq->content_type, 'text/plain', 'Catalyst::Request Content-Type' );
+    is( $creq->content_length, $request->content_length, 'Catalyst::Request Content-Length' );
+    is( $creq->body, $request->content, 'Catalyst::Request Content' );
+}
\ No newline at end of file