Skip to content

Commit

Permalink
better explanation for redirect_to
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Apr 6, 2016
1 parent 5f47058 commit 0a35b09
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Changes
@@ -1,5 +1,5 @@

6.58 2016-04-02
6.58 2016-04-06
- Added fork policy to Mojolicious::Guides::Contributing.
- Improved Mojo::JSON to generate canonical JSON objects.

Expand Down
10 changes: 9 additions & 1 deletion lib/Mojo/Message/Response.pm
Expand Up @@ -250,14 +250,22 @@ this method finalizes the response.
my $bool = $res->is_empty;
Check if this is a C<1xx>, C<204> or C<304> response.
Check if this response has a C<1xx>, C<204> or C<304> status code.
=head2 is_status_class
my $bool = $res->is_status_class(200);
Check response status class.
# True
Mojo::Message::Response->new->code(304)->is_status_class(300);
Mojo::Message::Response->new->code(404)->is_status_class(400);
# False
Mojo::Message::Response->new->code(404)->is_status_class(300);
Mojo::Message::Response->new->code(404)->is_status_class(200);
=head2 start_line_size
my $size = $req->start_line_size;
Expand Down
9 changes: 7 additions & 2 deletions lib/Mojolicious/Controller.pm
Expand Up @@ -610,12 +610,17 @@ For more control you can also access request information directly.
$c = $c->redirect_to('/index.html');
$c = $c->redirect_to('http://example.com/index.html');
Prepare a C<302> redirect response, takes the same arguments as L</"url_for">.
Prepare a C<302> (if the status code is not already C<3xx>) redirect response
with C<Location> header, takes the same arguments as L</"url_for">.
# Moved permanently
# Moved Permanently
$c->res->code(301);
$c->redirect_to('some_route');
# Temporary Redirect
$c->res->code(307);
$c->redirect_to('some_route');
=head2 render
my $bool = $c->render;
Expand Down

0 comments on commit 0a35b09

Please sign in to comment.