Engine::HTTP - Fix paths for HTTP requests with scheme and domain in URI.
[catagits/Catalyst-Runtime.git] / lib / Catalyst.pm
index 7556e34..61d9bfc 100644 (file)
@@ -1206,6 +1206,12 @@ path, use C<< $c->uri_for_action >> instead.
 sub uri_for {
     my ( $c, $path, @args ) = @_;
 
+    if (blessed($path) && $path->isa('Catalyst::Controller')) {
+        $path = $path->path_prefix;
+        $path =~ s{/+\z}{};
+        $path .= '/';
+    }
+
     if ( blessed($path) ) { # action object
         my $captures = ( scalar @args && ref $args[0] eq 'ARRAY'
                          ? shift(@args)