X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Flive_engine_request_parameters.t;h=060bc9e4c6ca6135adccf29d2f4cea2c0decd355;hb=f2e13bbd72d59b71fe8916aa802d2631217bd51d;hp=d93437d10b2e11cc5aa86a556e1c5e45e3be8c5a;hpb=de19de2e6f40d9f8986df5e4f37dc8084a7c83ee;p=catagits%2FCatalyst-Runtime.git diff --git a/t/live_engine_request_parameters.t b/t/live_engine_request_parameters.t index d93437d..060bc9e 100644 --- a/t/live_engine_request_parameters.t +++ b/t/live_engine_request_parameters.t @@ -6,7 +6,7 @@ use warnings; use FindBin; use lib "$FindBin::Bin/lib"; -use Test::More tests => 35; +use Test::More tests => 53; use Catalyst::Test 'TestApp'; use Catalyst::Request; @@ -48,6 +48,16 @@ use HTTP::Request::Common; { my $creq; + ok( my $response = request("http://localhost/dump/request?q=foo=bar"), + 'Request' ); + ok( $response->is_success, 'Response Successful 2xx' ); + is( $response->content_type, 'text/plain', 'Response Content-Type' ); + ok( eval '$creq = ' . $response->content ); + is $creq->{parameters}->{q}, 'foo=bar', '= not ignored'; +} + +{ + my $creq; my $parameters = { 'a' => [qw(A b C d E f G)], @@ -127,3 +137,26 @@ use HTTP::Request::Common; ok( eval '$creq = ' . $response->content, 'Unserialize Catalyst::Request' ); is( $creq->{uri}->query, 'x=1&y=1&z=1', 'Catalyst::Request GET query_string' ); } + +{ + my $creq; + ok( my $response = request("http://localhost/dump/request?&&q="), + 'Request' ); + ok( $response->is_success, 'Response Successful 2xx' ); + is( $response->content_type, 'text/plain', 'Response Content-Type' ); + ok( eval '$creq = ' . $response->content ); + is( keys %{$creq->{parameters}}, 1, 'remove empty parameter' ); + is( $creq->{parameters}->{q}, '', 'empty parameter' ); +} + +{ + my $creq; + ok( my $response = request("http://localhost/dump/request?&0&q="), + 'Request' ); + ok( $response->is_success, 'Response Successful 2xx' ); + is( $response->content_type, 'text/plain', 'Response Content-Type' ); + ok( eval '$creq = ' . $response->content ); + is( keys %{$creq->{parameters}}, 2, 'remove empty parameter' ); + is( $creq->{parameters}->{q}, '', 'empty parameter' ); + ok( !defined $creq->{parameters}->{0}, 'empty parameter' ); +}