path or pathparts in your actions. query and body parameter keys are now also
subject to utf8 decoding (or as specificed via the encoding configuration value).
- lots of UTF8 changes. Again we think this is now more correct but please test.
+ - Allow $c->res->redirect($url) to accept $url as an object that does ->as_string
+ which I think will ease a common case (and common bug) and added documentation.
5.90077 - 2014-11-18
- We store the PSGI $env in Catalyst::Engine for backcompat reasons. Changed
thing and is not a standard behaviour. You may opt to use uri_for() or
uri_for_action() instead.
+B<Note:> If $url is an object that does ->as_string (such as L<URI>, which is
+what you get from ->uri_for) we automatically call that to stringify. This
+should ease the common case usage
+
+ return $c->res->redirect( $c->uri_for(...));
+
=cut
sub redirect {
my $location = shift;
my $status = shift || 302;
+ if(blessed($location) && $location->can('as_string')) {
+ $location = $location->as_string;
+ }
+
$self->location($location);
$self->status($status);
}
is decode_utf8($res->content), "$url", 'correct body'; #should do nothing
is $res->content, "$url", 'correct body';
is $res->content_length, 90, 'correct length';
+
+ # Test to make sure redirect can now take an object (sorry don't have a better place for it
+ # but wanted test coverage.
+ my $location = $c->res->redirect( $c->uri_for($c->controller('Root')->action_for('uri_for')) );
+ ok !ref $location;
}
done_testing;