7 use lib "$FindBin::Bin/../lib";
9 use Test::More tests => 18;
10 use Catalyst::Test 'TestApp';
12 use Catalyst::Request;
14 use HTTP::Request::Common;
20 'http://localhost/dump/request/',
21 'Content-Type' => 'text/plain',
22 'Content' => 'Hello Catalyst'
25 ok( my $response = request($request), 'Request' );
26 ok( $response->is_success, 'Response Successful 2xx' );
27 is( $response->content_type, 'text/plain', 'Response Content-Type' );
28 like( $response->content, qr/'Catalyst::Request'/,
29 'Content is a serialized Catalyst::Request' );
34 eval '$creq = ' . $response->content,
35 'Unserialize Catalyst::Request'
39 isa_ok( $creq, 'Catalyst::Request' );
40 is( $creq->method, 'POST', 'Catalyst::Request method' );
41 is( $creq->content_type, 'text/plain', 'Catalyst::Request Content-Type' );
42 is( $creq->content_length, $request->content_length,
43 'Catalyst::Request Content-Length' );
50 'http://localhost/dump/request/',
51 'Content-Type' => 'text/plain',
52 'Content' => 'x' x 100_000
55 ok( my $response = request($request), 'Request' );
56 ok( $response->is_success, 'Response Successful 2xx' );
57 is( $response->content_type, 'text/plain', 'Response Content-Type' );
60 qr/^bless\( .* 'Catalyst::Request' \)$/s,
61 'Content is a serialized Catalyst::Request'
67 eval '$creq = ' . $response->content,
68 'Unserialize Catalyst::Request'
72 isa_ok( $creq, 'Catalyst::Request' );
73 is( $creq->method, 'POST', 'Catalyst::Request method' );
74 is( $creq->content_type, 'text/plain', 'Catalyst::Request Content-Type' );
75 is( $creq->content_length, $request->content_length,
76 'Catalyst::Request Content-Length' );
79 # 5.80 regression, see note in Catalyst::Plugin::Test::Plugin
81 local $TODO = 'On demand request body parsing in prepare_action broken';
84 'http://localhost/have_req_body_in_prepare_action',
85 'Content-Type' => 'text/plain',
86 'Content' => 'x' x 100_000
89 ok( my $response = request($request), 'Request' );
90 ok( $response->is_success, 'Response Successful 2xx' );
91 like( $response->content, qr/^[1-9]/, 'Has body' );