Skip to content

Commit

Permalink
better request information example for tutorial
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Mar 30, 2013
1 parent 4504dda commit ca7359d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/Mojolicious/Lite.pm
Expand Up @@ -217,8 +217,10 @@ full access to all HTTP features and information.
# Access response and request headers
get '/agent' => sub {
my $self = shift;
my $host = $self->req->url->to_abs->host;
my $ua = $self->req->headers->user_agent;
$self->res->headers->header('X-Bender' => 'Bite my shiny metal ass!');
$self->render(text => $self->req->headers->user_agent);
$self->render(text => qq{Request by "$ua" reached $host.});
};
app->start;
Expand Down

0 comments on commit ca7359d

Please sign in to comment.