Skip to content

Commit

Permalink
list param sources in order of precedence
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Oct 17, 2013
1 parent cfe02df commit 6c3f774
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
12 changes: 6 additions & 6 deletions lib/Mojolicious/Controller.pm
Expand Up @@ -620,12 +620,12 @@ status.
$c = $c->param(foo => 'ba;r');
$c = $c->param(foo => qw(ba;r ba;z));
Access GET/POST parameters, file uploads and route placeholder values that are
not reserved stash values. Note that this method is context sensitive in some
cases and therefore needs to be used with care, there can always be multiple
values, which might have unexpected consequences. Parts of the request body
need to be loaded into memory to parse POST parameters, so you have to make
sure it is not excessively large.
Access route placeholder values that are not reserved stash values, file
uploads and GET/POST parameters, in that order. Note that this method is
context sensitive in some cases and therefore needs to be used with care,
there can always be multiple values, which might have unexpected consequences.
Parts of the request body need to be loaded into memory to parse POST
parameters, so you have to make sure it is not excessively large.
# List context is ambiguous and should be avoided
my $hash = {foo => $self->param('foo')};
Expand Down
2 changes: 2 additions & 0 deletions t/mojo/response.t
Expand Up @@ -194,6 +194,7 @@ is $res->message, 'Internal Server Error', 'right message';
is $res->version, '1.0', 'right version';
is $res->headers->content_type, 'text/plain', 'right "Content-Type" value';
is $res->headers->content_length, 27, 'right "Content-Length" value';
is $res->body, "Hello World!\n1234\nlalalala\n", 'right content';

# Parse full HTTP 1.0 response (no limit)
{
Expand All @@ -211,6 +212,7 @@ is $res->headers->content_length, 27, 'right "Content-Length" value';
is $res->version, '1.0', 'right version';
is $res->headers->content_type, 'text/plain', 'right "Content-Type" value';
is $res->headers->content_length, 27, 'right "Content-Length" value';
is $res->body, "Hello World!\n1234\nlalalala\n", 'right content';
}

# Parse full HTTP 1.0 response (missing Content-Length)
Expand Down

0 comments on commit 6c3f774

Please sign in to comment.