X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=blobdiff_plain;f=t%2Flive_engine_request_uri.t;h=3bfaec47be5dac928176589b5c1f76ea263c9b15;hp=5af97f9a20886883f005d5a1d64efa340f7933ad;hb=bd917b94298b00325cb9db7551897c2471ca78ff;hpb=4fe3060e61eb26afd26a6487ef52de2902d5f903 diff --git a/t/live_engine_request_uri.t b/t/live_engine_request_uri.t index 5af97f9..3bfaec4 100644 --- a/t/live_engine_request_uri.t +++ b/t/live_engine_request_uri.t @@ -6,7 +6,7 @@ use warnings; use FindBin; use lib "$FindBin::Bin/lib"; -use Test::More tests => 23; +use Test::More tests => 35; use Catalyst::Test 'TestApp'; use Catalyst::Request; @@ -59,3 +59,27 @@ my $creq; is( $creq->{uri}->query, 'text=Catalyst%20Rocks', 'Query string ok' ); is( $creq->{parameters}->{text}, 'Catalyst Rocks', 'Unescaped param ok' ); } + +# test that uri_with adds params +{ + ok( my $response = request('http://localhost/engine/request/uri/uri_with'), 'Request' ); + 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' ); +} + +# test that uri_with adds params (and preserves) +{ + ok( my $response = request('http://localhost/engine/request/uri/uri_with?a=1'), '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' ); +} + +# 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( $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' ); +}