X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FCatalyst%2FTest.pm;h=9f2f7bed59a65a2798d308fa2a03aa2444b983ab;hb=6a5aa41cfee356f6d9cab2e041cec6f6f6dc8dec;hp=84ba98ad986d4e487ba2ee637b3dc453b8c8682b;hpb=a7daf37e6f5527ee3a601bffb3df321e53327d89;p=catagits%2FCatalyst-Runtime.git diff --git a/lib/Catalyst/Test.pm b/lib/Catalyst/Test.pm index 84ba98a..9f2f7be 100644 --- a/lib/Catalyst/Test.pm +++ b/lib/Catalyst/Test.pm @@ -136,12 +136,16 @@ sub remote_request { if ( $server->path =~ m|^(.+)?/$| ) { $server->path("$1"); # need to be quoted - } + } # the request path needs to be sanitised if $server is using a # non-root path due to potential overlap between request path and # response path. if ($server->path) { + # If request path is '/', we have to add a trailing slash to the + # final request URI + my $add_trailing = $request->uri->path eq '/'; + my @sp = split '/', $server->path; my @rp = split '/', $request->uri->path; shift @sp;shift @rp; # leading / @@ -151,6 +155,10 @@ sub remote_request { } } $request->uri->path(join '/', @rp); + + if ( $add_trailing ) { + $request->uri->path( $request->uri->path . '/' ); + } } $request->uri->scheme( $server->scheme );