Skip to content

Commit

Permalink
do not change path_info in the matched params for the consistency (i …
Browse files Browse the repository at this point in the history
…think)
  • Loading branch information
miyagawa committed Mar 20, 2010
1 parent 71e0424 commit 8bc5ce2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
3 changes: 1 addition & 2 deletions lib/Piglet/Routes.pm
Expand Up @@ -17,9 +17,8 @@ sub match {
# magic path_info
if (exists $m->{path_info}) {
if ($env->{PATH_INFO} =~ s!^(.*?)(/?)\Q$m->{path_info}\E$!!) {
$m->{path_info} = $2 . $m->{path_info};
$env->{SCRIPT_NAME} .= $1;
$env->{PATH_INFO} = $m->{path_info};
$env->{PATH_INFO} = $2 . $m->{path_info};
} else {
# Hmm what should it do?
}
Expand Down
4 changes: 2 additions & 2 deletions t/routes/simple.t
Expand Up @@ -30,7 +30,7 @@ $r->connect("/admin/{path_info:.*}", { app => "Admin" });
is $env->{PATH_INFO}, '/admin/login/me';

my $m = $r->match($env);
is_deeply $m, { app => "Admin", path_info => "/login/me" };
is_deeply $m, { app => "Admin", path_info => "login/me" };
is $env->{SCRIPT_NAME}, '/admin';
is $env->{PATH_INFO}, '/login/me';
}
Expand All @@ -39,7 +39,7 @@ $r->connect("/admin/{path_info:.*}", { app => "Admin" });
my $env = env "/admin/0";

my $m = $r->match($env);
is_deeply $m, { app => "Admin", path_info => "/0" };
is_deeply $m, { app => "Admin", path_info => "0" };
is $env->{SCRIPT_NAME}, '/admin';
is $env->{PATH_INFO}, '/0';
}
Expand Down

0 comments on commit 8bc5ce2

Please sign in to comment.