Skip to content

Commit

Permalink
improved redirect_to to behave more like url_for
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Jun 11, 2014
1 parent 40e04b7 commit c58082b
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion Changes
@@ -1,5 +1,6 @@

5.06 2014-06-10
5.06 2014-06-11
- Improved redirect_to to behave more like url_for.

5.05 2014-06-08
- Fixed parsing of header fields with single character names in
Expand Down
2 changes: 1 addition & 1 deletion lib/Mojolicious/Controller.pm
Expand Up @@ -140,7 +140,7 @@ sub redirect_to {

# Don't override 3xx status
my $res = $self->res;
$res->headers->location($self->url_for(@_)->to_abs);
$res->headers->location($self->url_for(@_));
return $self->rendered($res->is_status_class(300) ? () : 302);
}

Expand Down
2 changes: 1 addition & 1 deletion t/mojolicious/rebased_lite_app.t
Expand Up @@ -74,7 +74,7 @@ EOF
ok !$t->ua->cookie_jar->find($t->ua->server->url->path('/foo')),
'no session cookie';
$t->get_ok('/bar')->status_is(302)->header_is('X-Route' => 'bar')
->header_is(Location => 'http://example.com/rebased/foo');
->header_is(Location => '/rebased/foo');
ok $t->ua->cookie_jar->find($t->ua->server->url->path('/foo')),
'session cookie';

Expand Down

0 comments on commit c58082b

Please sign in to comment.