[Catalyst-commits] r9699 - in Catalyst-Runtime/5.80/trunk: .
t/aggregate t/lib/TestApp/Controller/Engine/Request
t0m at dev.catalyst.perl.org
t0m at dev.catalyst.perl.org
Tue Apr 14 19:25:45 GMT 2009
Author: t0m
Date: 2009-04-14 20:25:44 +0100 (Tue, 14 Apr 2009)
New Revision: 9699
Modified:
Catalyst-Runtime/5.80/trunk/Changes
Catalyst-Runtime/5.80/trunk/t/aggregate/live_engine_request_uri.t
Catalyst-Runtime/5.80/trunk/t/lib/TestApp/Controller/Engine/Request/URI.pm
Log:
Test uri_with clears query params
Modified: Catalyst-Runtime/5.80/trunk/Changes
===================================================================
--- Catalyst-Runtime/5.80/trunk/Changes 2009-04-14 14:25:22 UTC (rev 9698)
+++ Catalyst-Runtime/5.80/trunk/Changes 2009-04-14 19:25:44 UTC (rev 9699)
@@ -1,5 +1,8 @@
# This file documents the revision history for Perl extension Catalyst.
+ - Test uri_with clears query params when they are set to undef
+ (Ian Wells)
+
5.8000_07 2009-04-12 13:37
- Add the Catalyst::Dispatcher->dispatch_type method (ash)
- Throw an exception rather than loading an app if an action
Modified: Catalyst-Runtime/5.80/trunk/t/aggregate/live_engine_request_uri.t
===================================================================
--- Catalyst-Runtime/5.80/trunk/t/aggregate/live_engine_request_uri.t 2009-04-14 14:25:22 UTC (rev 9698)
+++ Catalyst-Runtime/5.80/trunk/t/aggregate/live_engine_request_uri.t 2009-04-14 19:25:44 UTC (rev 9699)
@@ -4,7 +4,7 @@
use FindBin;
use lib "$FindBin::Bin/../lib";
-use Test::More tests => 68;
+use Test::More tests => 74;
use Catalyst::Test 'TestApp';
use Catalyst::Request;
@@ -79,6 +79,8 @@
ok( $response->is_success, 'Response Successful 2xx' );
ok( !defined $response->header( 'X-Catalyst-Param-a' ), 'param "a" ok' );
is( $response->header( 'X-Catalyst-Param-b' ), '1', 'param "b" ok' );
+ is( $response->header( 'X-Catalyst-Param-c' ), '--notexists--', 'param "c" ok' );
+ unlike($response->header ('X-Catalyst-query'), qr/c=/, 'no c in return');
}
# test that uri_with adds params (and preserves)
@@ -87,14 +89,18 @@
ok( $response->is_success, 'Response Successful 2xx' );
is( $response->header( 'X-Catalyst-Param-a' ), '1', 'param "a" ok' );
is( $response->header( 'X-Catalyst-Param-b' ), '1', 'param "b" ok' );
+ is( $response->header( 'X-Catalyst-Param-c' ), '--notexists--', 'param "c" ok' );
+ unlike($response->header ('X-Catalyst-query'), qr/c=/, 'no c in return');
}
# test that uri_with replaces params (and preserves)
{
- ok( my $response = request('http://localhost/engine/request/uri/uri_with?a=1&b=2'), 'Request' );
+ ok( my $response = request('http://localhost/engine/request/uri/uri_with?a=1&b=2&c=3'), 'Request' );
ok( $response->is_success, 'Response Successful 2xx' );
is( $response->header( 'X-Catalyst-Param-a' ), '1', 'param "a" ok' );
is( $response->header( 'X-Catalyst-Param-b' ), '1', 'param "b" ok' );
+ is( $response->header( 'X-Catalyst-Param-c' ), '--notexists--', 'param "c" deleted ok' );
+ unlike($response->header ('X-Catalyst-query'), qr/c=/, 'no c in return');
}
# test that uri_with replaces params (and preserves)
Modified: Catalyst-Runtime/5.80/trunk/t/lib/TestApp/Controller/Engine/Request/URI.pm
===================================================================
--- Catalyst-Runtime/5.80/trunk/t/lib/TestApp/Controller/Engine/Request/URI.pm 2009-04-14 14:25:22 UTC (rev 9698)
+++ Catalyst-Runtime/5.80/trunk/t/lib/TestApp/Controller/Engine/Request/URI.pm 2009-04-14 19:25:44 UTC (rev 9699)
@@ -32,11 +32,13 @@
my ( $self, $c ) = @_;
# change the current uri
- my $uri = $c->req->uri_with( { b => 1 } );
+ my $uri = $c->req->uri_with( { b => 1, c => undef } );
my %query = $uri->query_form;
$c->res->header( 'X-Catalyst-Param-a' => $query{ a } );
$c->res->header( 'X-Catalyst-Param-b' => $query{ b } );
+ $c->res->header( 'X-Catalyst-Param-c' => exists($query{ c }) ? $query{ c } : '--notexists--' );
+ $c->res->header( 'X-Catalyst-query' => $uri->query);
$c->forward('TestApp::View::Dump::Request');
}
More information about the Catalyst-commits
mailing list