[Catalyst-commits] r10159 - in Catalyst-Runtime/5.80/trunk/t:
aggregate lib/TestAppOnDemand/Controller
t0m at dev.catalyst.perl.org
t0m at dev.catalyst.perl.org
Thu May 14 17:29:56 GMT 2009
Author: t0m
Date: 2009-05-14 17:29:55 +0000 (Thu, 14 May 2009)
New Revision: 10159
Modified:
Catalyst-Runtime/5.80/trunk/t/aggregate/live_engine_request_body_demand.t
Catalyst-Runtime/5.80/trunk/t/lib/TestAppOnDemand/Controller/Body.pm
Log:
Add tests to show that 5.80 broke ->req->parameters when you do on-demand parsing.
Modified: Catalyst-Runtime/5.80/trunk/t/aggregate/live_engine_request_body_demand.t
===================================================================
--- Catalyst-Runtime/5.80/trunk/t/aggregate/live_engine_request_body_demand.t 2009-05-14 15:33:42 UTC (rev 10158)
+++ Catalyst-Runtime/5.80/trunk/t/aggregate/live_engine_request_body_demand.t 2009-05-14 17:29:55 UTC (rev 10159)
@@ -6,7 +6,7 @@
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 +18,44 @@
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 = { 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 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' };
+ my $expected = { foo => 'bar', baz => 'quux', wibble => 'wobble' };
ok( my $response = request($request), 'Request' );
ok( $response->is_success, 'Response Successful 2xx' );
@@ -43,7 +68,7 @@
);
}
- is_deeply( $params, $expected, 'Catalyst::Request body parameters' );
+ is_deeply( $params, $expected, 'Catalyst::Request body and query parameters' );
}
# Test reading chunks of the request body using $c->read
Modified: Catalyst-Runtime/5.80/trunk/t/lib/TestAppOnDemand/Controller/Body.pm
===================================================================
--- Catalyst-Runtime/5.80/trunk/t/lib/TestAppOnDemand/Controller/Body.pm 2009-05-14 15:33:42 UTC (rev 10158)
+++ Catalyst-Runtime/5.80/trunk/t/lib/TestAppOnDemand/Controller/Body.pm 2009-05-14 17:29:55 UTC (rev 10159)
@@ -5,12 +5,24 @@
use Data::Dump ();
-sub params : Local {
+sub body_params : Local {
my ( $self, $c ) = @_;
$c->res->body( Data::Dump::dump( $c->req->body_parameters ) );
}
+sub query_params : Local {
+ my ( $self, $c ) = @_;
+
+ $c->res->body( Data::Dump::dump( $c->req->query_parameters ) );
+}
+
+sub params : Local {
+ my ( $self, $c ) = @_;
+
+ $c->res->body( Data::Dump::dump( $c->req->parameters ) );
+}
+
sub read : Local {
my ( $self, $c ) = @_;
More information about the Catalyst-commits
mailing list