X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Faggregate%2Flive_engine_request_escaped_path.t;h=fca5a05550798a1c84b5a56b892cefa0a5449921;hb=a0d17f88492e2f5929aaeade9eab441adde68a74;hp=c280b084472acb1532249f0f03594ae21ec18336;hpb=b4b58469aa968bd0e379d1e2af69f54eb5a91f8f;p=catagits%2FCatalyst-Runtime.git diff --git a/t/aggregate/live_engine_request_escaped_path.t b/t/aggregate/live_engine_request_escaped_path.t index c280b08..fca5a05 100644 --- a/t/aggregate/live_engine_request_escaped_path.t +++ b/t/aggregate/live_engine_request_escaped_path.t @@ -13,7 +13,7 @@ use HTTP::Request::AsCGI; This test exposes a problem in the handling of PATH_INFO in C::Engine::CGI (and other engines) where Catalyst does not un-escape the request correctly. -If a request is URL-encoded then Catalyst fails to decode the request +If a request is URL-encoded then Catalyst fails to decode the request and thus will try and match actions using the URL-encoded value. Can NOT use Catalyst::Test as it uses HTTP::Request::AsCGI which does @@ -31,11 +31,11 @@ Index: lib/Catalyst/Engine/CGI.pm @@ -157,6 +157,8 @@ my $query = $ENV{QUERY_STRING} ? '?' . $ENV{QUERY_STRING} : ''; my $uri = $scheme . '://' . $host . '/' . $path . $query; - + + $uri = URI->new( $uri )->canonical; + $c->request->uri( bless \$uri, $uri_class ); - + # set the base URI =cut @@ -46,7 +46,7 @@ Index: lib/Catalyst/Engine/CGI.pm my $request = Catalyst::Utils::request( 'http://localhost/args/params/one/two' ); my $cgi = HTTP::Request::AsCGI->new( $request, %ENV )->setup; - TestApp->handle_request; + TestApp->handle_request( env => \%ENV ); ok( my $response = $cgi->restore->response ); ok( $response->is_success, 'Response Successful 2xx' ); @@ -54,8 +54,7 @@ Index: lib/Catalyst/Engine/CGI.pm } # test that request with URL-escaped code works. -TODO: { - local $TODO = 'Actions should match when path parts are url encoded'; +{ my $request = Catalyst::Utils::request( 'http://localhost/args/param%73/one/two' ); my $cgi = HTTP::Request::AsCGI->new( $request, %ENV )->setup; @@ -64,7 +63,7 @@ TODO: { $ENV{PATH_INFO} = '/args/param%73/one/two'; - TestApp->handle_request; + TestApp->handle_request( env => \%ENV ); ok( my $response = $cgi->restore->response ); ok( $response->is_success, 'Response Successful 2xx' );