X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=blobdiff_plain;f=t%2Faggregate%2Flive_engine_request_body_demand.t;h=cfbeb8f0deb67caaf08ae1d7e331c1d432d5b953;hp=b4d78898abb2b5a0ec06074d7a6a5c251cbd7dbc;hb=88e5a8b0c4d28e46b8ba6b6b9567063e57af9063;hpb=ae29b412955743885e80350085167b54b69672da diff --git a/t/aggregate/live_engine_request_body_demand.t b/t/aggregate/live_engine_request_body_demand.t index b4d7889..cfbeb8f 100644 --- a/t/aggregate/live_engine_request_body_demand.t +++ b/t/aggregate/live_engine_request_body_demand.t @@ -1,12 +1,10 @@ -#!perl - use strict; use warnings; use FindBin; use lib "$FindBin::Bin/../lib"; -use Test::More tests => 8; +use Test::More tests => 12; use Catalyst::Test 'TestAppOnDemand'; use Catalyst::Request; @@ -18,19 +16,19 @@ use HTTP::Request::Common; SKIP: { if ( $ENV{CATALYST_SERVER} ) { - skip "Using remote server", 8; + skip "Using remote server", 12; } - + { my $params; my $request = POST( - 'http://localhost/body/params', + 'http://localhost/body/query_params?wibble=wobble', 'Content-Type' => 'application/x-www-form-urlencoded', 'Content' => 'foo=bar&baz=quux' ); - - my $expected = { foo => 'bar', baz => 'quux' }; + + my $expected = { wibble => 'wobble' }; ok( my $response = request($request), 'Request' ); ok( $response->is_success, 'Response Successful 2xx' ); @@ -43,19 +41,43 @@ SKIP: ); } - is_deeply( $params, $expected, 'Catalyst::Request body parameters' ); + is_deeply( $params, $expected, 'Catalyst::Request query parameters' ); + } + + { + my $params; + + my $request = POST( + 'http://localhost/body/params?wibble=wobble', + 'Content-Type' => 'application/x-www-form-urlencoded', + 'Content' => 'foo=bar&baz=quux' + ); + + my $expected = { foo => 'bar', baz => 'quux', wibble => 'wobble' }; + + ok( my $response = request($request), 'Request' ); + ok( $response->is_success, 'Response Successful 2xx' ); + { + no strict 'refs'; + ok( + eval '$params = ' . $response->content, + 'Unserialize params' + ); + } + + is_deeply( $params, $expected, 'Catalyst::Request body and query parameters' ); } # Test reading chunks of the request body using $c->read { my $creq; - + my $request = POST( 'http://localhost/body/read', 'Content-Type' => 'text/plain', 'Content' => 'x' x 105_000 ); - + my $expected = '10000|10000|10000|10000|10000|10000|10000|10000|10000|10000|5000'; ok( my $response = request($request), 'Request' );