Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
added custom response example
  • Loading branch information
kraih committed Feb 4, 2014
1 parent 9a37b23 commit f5f0bd2
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions lib/Mojolicious/Controller.pm
Expand Up @@ -663,9 +663,6 @@ For more control you can also access request information directly.
Prepare a C<302> redirect response, takes the same arguments as L</"url_for">.
# Conditional redirect
return $c->redirect_to('login') unless $c->session('user');
# Moved permanently
$c->res->code(301);
$c->redirect_to('some_route');
Expand Down Expand Up @@ -768,6 +765,11 @@ method does not protect from traversing to parent directories.
Finalize response and emit hook L<Mojolicious/"after_dispatch">, defaults to
using a C<200> response code.
# Custom response
$self->res->headers->content_type('text/plain');
$self->res->body('Hello World!');
$self->rendered(200);
=head2 req
my $req = $c->req;
Expand Down

0 comments on commit f5f0bd2

Please sign in to comment.