Skip to content

Commit

Permalink
highlight request methods
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Mar 15, 2014
1 parent a22d469 commit bb1a807
Show file tree
Hide file tree
Showing 15 changed files with 89 additions and 87 deletions.
8 changes: 4 additions & 4 deletions lib/Mojo/Message.pm
Expand Up @@ -423,11 +423,11 @@ automatically downgraded to L<Mojo::Content::Single>.
my $params = $msg->body_params;
POST parameters extracted from C<application/x-www-form-urlencoded> or
C<POST> parameters extracted from C<application/x-www-form-urlencoded> or
C<multipart/form-data> message body, usually a L<Mojo::Parameters> object.
Note that this method caches all data, so it should not be called before the
entire message body has been received. Parts of the message body need to be
loaded into memory to parse POST parameters, so you have to make sure it is
loaded into memory to parse C<POST> parameters, so you have to make sure it is
not excessively large.
# Get POST parameter value
Expand Down Expand Up @@ -587,9 +587,9 @@ sure it is not excessively large.
my $foo = $msg->param('foo');
my @foo = $msg->param('foo');
Access POST parameters. Note that this method caches all data, so it should
Access C<POST> parameters. Note that this method caches all data, so it should
not be called before the entire message body has been received. Parts of the
message body need to be loaded into memory to parse POST parameters, so you
message body need to be loaded into memory to parse C<POST> parameters, so you
have to make sure it is not excessively large.
=head2 parse
Expand Down
16 changes: 8 additions & 8 deletions lib/Mojo/Message/Request.pm
Expand Up @@ -387,19 +387,19 @@ Check C<X-Requested-With> header for C<XMLHttpRequest> value.
my $foo = $req->param('foo');
my @foo = $req->param('foo');
Access GET and POST parameters. Note that this method caches all data, so it
should not be called before the entire request body has been received. 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 C<GET> and C<POST> parameters. Note that this method caches all data,
so it should not be called before the entire request body has been received.
Parts of the request body need to be loaded into memory to parse C<POST>
parameters, so you have to make sure it is not excessively large.
=head2 params
my $params = $req->params;
All GET and POST parameters, usually a L<Mojo::Parameters> object. Note that
this method caches all data, so it should not be called before the entire
All C<GET> and C<POST> parameters, usually a L<Mojo::Parameters> object. Note
that this method caches all data, so it should not be called before the entire
request body has been received. Parts of the request body need to be loaded
into memory to parse POST parameters, so you have to make sure it is not
into memory to parse C<POST> parameters, so you have to make sure it is not
excessively large.
# Get parameter value
Expand Down Expand Up @@ -428,7 +428,7 @@ Proxy URL for request.
my $params = $req->query_params;
All GET parameters, usually a L<Mojo::Parameters> object.
All C<GET> parameters, usually a L<Mojo::Parameters> object.
# Turn GET parameters to hash and extract value
say $req->query_params->to_hash->{foo};
Expand Down
44 changes: 22 additions & 22 deletions lib/Mojo/UserAgent.pm
Expand Up @@ -713,7 +713,7 @@ L<Mojo::UserAgent::Transactor/"websocket">.
my $tx = $ua->delete(
'http://example.com' => {DNT => 1} => json => {a => 'b'});
Perform blocking DELETE request and return resulting
Perform blocking C<DELETE> request and return resulting
L<Mojo::Transaction::HTTP> object, takes the same arguments as
L<Mojo::UserAgent::Transactor/"tx"> (except for the method). You can also
append a callback to perform requests non-blocking.
Expand All @@ -731,10 +731,10 @@ append a callback to perform requests non-blocking.
my $tx = $ua->get('http://example.com' => {DNT => 1} => form => {a => 'b'});
my $tx = $ua->get('http://example.com' => {DNT => 1} => json => {a => 'b'});
Perform blocking GET request and return resulting L<Mojo::Transaction::HTTP>
object, takes the same arguments as L<Mojo::UserAgent::Transactor/"tx">
(except for the method). You can also append a callback to perform requests
non-blocking.
Perform blocking C<GET> request and return resulting
L<Mojo::Transaction::HTTP> object, takes the same arguments as
L<Mojo::UserAgent::Transactor/"tx"> (except for the method). You can also
append a callback to perform requests non-blocking.
$ua->get('http://example.com' => sub {
my ($ua, $tx) = @_;
Expand All @@ -751,10 +751,10 @@ non-blocking.
my $tx = $ua->head(
'http://example.com' => {DNT => 1} => json => {a => 'b'});
Perform blocking HEAD request and return resulting L<Mojo::Transaction::HTTP>
object, takes the same arguments as L<Mojo::UserAgent::Transactor/"tx">
(except for the method). You can also append a callback to perform requests
non-blocking.
Perform blocking C<HEAD> request and return resulting
L<Mojo::Transaction::HTTP> object, takes the same arguments as
L<Mojo::UserAgent::Transactor/"tx"> (except for the method). You can also
append a callback to perform requests non-blocking.
$ua->head('http://example.com' => sub {
my ($ua, $tx) = @_;
Expand All @@ -771,7 +771,7 @@ non-blocking.
my $tx = $ua->options(
'http://example.com' => {DNT => 1} => json => {a => 'b'});
Perform blocking OPTIONS request and return resulting
Perform blocking C<OPTIONS> request and return resulting
L<Mojo::Transaction::HTTP> object, takes the same arguments as
L<Mojo::UserAgent::Transactor/"tx"> (except for the method). You can also
append a callback to perform requests non-blocking.
Expand All @@ -791,10 +791,10 @@ append a callback to perform requests non-blocking.
my $tx = $ua->patch(
'http://example.com' => {DNT => 1} => json => {a => 'b'});
Perform blocking PATCH request and return resulting L<Mojo::Transaction::HTTP>
object, takes the same arguments as L<Mojo::UserAgent::Transactor/"tx">
(except for the method). You can also append a callback to perform requests
non-blocking.
Perform blocking C<PATCH> request and return resulting
L<Mojo::Transaction::HTTP> object, takes the same arguments as
L<Mojo::UserAgent::Transactor/"tx"> (except for the method). You can also
append a callback to perform requests non-blocking.
$ua->patch('http://example.com' => sub {
my ($ua, $tx) = @_;
Expand All @@ -811,10 +811,10 @@ non-blocking.
my $tx = $ua->post(
'http://example.com' => {DNT => 1} => json => {a => 'b'});
Perform blocking POST request and return resulting L<Mojo::Transaction::HTTP>
object, takes the same arguments as L<Mojo::UserAgent::Transactor/"tx">
(except for the method). You can also append a callback to perform requests
non-blocking.
Perform blocking C<POST> request and return resulting
L<Mojo::Transaction::HTTP> object, takes the same arguments as
L<Mojo::UserAgent::Transactor/"tx"> (except for the method). You can also
append a callback to perform requests non-blocking.
$ua->post('http://example.com' => sub {
my ($ua, $tx) = @_;
Expand All @@ -829,10 +829,10 @@ non-blocking.
my $tx = $ua->put('http://example.com' => {DNT => 1} => form => {a => 'b'});
my $tx = $ua->put('http://example.com' => {DNT => 1} => json => {a => 'b'});
Perform blocking PUT request and return resulting L<Mojo::Transaction::HTTP>
object, takes the same arguments as L<Mojo::UserAgent::Transactor/"tx">
(except for the method). You can also append a callback to perform requests
non-blocking.
Perform blocking C<PUT> request and return resulting
L<Mojo::Transaction::HTTP> object, takes the same arguments as
L<Mojo::UserAgent::Transactor/"tx"> (except for the method). You can also
append a callback to perform requests non-blocking.
$ua->put('http://example.com' => sub {
my ($ua, $tx) = @_;
Expand Down
8 changes: 4 additions & 4 deletions lib/Mojo/UserAgent/Transactor.pm
Expand Up @@ -329,7 +329,7 @@ Actual peer for transaction.
my $tx = $t->proxy_connect(Mojo::Transaction::HTTP->new);
Build L<Mojo::Transaction::HTTP> proxy connect request for transaction if
Build L<Mojo::Transaction::HTTP> proxy C<CONNECT> request for transaction if
possible.
=head2 redirect
Expand Down Expand Up @@ -418,9 +418,9 @@ requests, with support for content generators.
});
The C<form> content generator will automatically use query parameters for
GET/HEAD requests and the "application/x-www-form-urlencoded" content type for
everything else. Both get upgraded automatically to using the
"multipart/form-data" content type when necessary or when the header has been
C<GET>/C<HEAD> requests and the C<application/x-www-form-urlencoded> content
type for everything else. Both get upgraded automatically to using the
C<multipart/form-data> content type when necessary or when the header has been
set manually.
# Force "multipart/form-data"
Expand Down
12 changes: 6 additions & 6 deletions lib/Mojolicious/Controller.pm
Expand Up @@ -588,10 +588,10 @@ status.
$c = $c->param(foo => qw(ba;r ba;z));
Access route placeholder values that are not reserved stash values, file
uploads and GET/POST parameters, in that order. Note that this method is
uploads and C<GET>/C<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
Parts of the request body need to be loaded into memory to parse C<POST>
parameters, so you have to make sure it is not excessively large.
# List context is ambiguous and should be avoided
Expand Down Expand Up @@ -781,7 +781,7 @@ Get L<Mojo::Message::Response> object from L<Mojo::Transaction/"res">.
);
Automatically select best possible representation for resource from C<Accept>
request header, C<format> stash value or C<format> GET/POST parameter,
request header, C<format> stash value or C<format> C<GET>/C<POST> parameter,
defaults to rendering an empty C<204> response. Since browsers often don't
really know what they actually want, unspecific C<Accept> request headers with
more than one MIME type will be ignored, unless the C<X-Requested-With> header
Expand Down Expand Up @@ -924,9 +924,9 @@ to inherit query parameters from the current request.
my $validation = $c->validation;
Get L<Mojolicious::Validator::Validation> object for current request to
validate GET/POST parameters. 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.
validate C<GET>/C<POST> parameters. Parts of the request body need to be
loaded into memory to parse C<POST> parameters, so you have to make sure it is
not excessively large.
my $validation = $c->validation;
$validation->required('title')->size(3, 50);
Expand Down
8 changes: 5 additions & 3 deletions lib/Mojolicious/Guides/Growing.pod
Expand Up @@ -79,8 +79,9 @@ all session state is kept client-side.
| | <- 200 OK <- | |
+---------+ +------------+

While HTTP methods such as PUT, GET and DELETE are not directly part of REST
they go very well with it and are commonly used to manipulate I<resources>.
While HTTP methods such as C<PUT>, C<GET> and C<DELETE> are not directly part
of REST they go very well with it and are commonly used to manipulate
I<resources>.

=head2 Sessions

Expand Down Expand Up @@ -268,7 +269,8 @@ templates.
app->start;

The method L<Mojolicious::Controller/"param"> is used to access query
parameters, POST parameters, file uploads and route placeholders, all at once.
parameters, C<POST> parameters, file uploads and route placeholders, all at
once.

=head2 Testing

Expand Down
4 changes: 2 additions & 2 deletions lib/Mojolicious/Guides/Rendering.pod
Expand Up @@ -332,7 +332,7 @@ L<Mojolicious::Controller/"render">.
);

The best possible representation will be automatically selected from the
C<Accept> request header, C<format> stash value or C<format> GET/POST
C<Accept> request header, C<format> stash value or C<format> C<GET>/C<POST>
parameter and stored in the C<format> stash value. To change MIME type
mappings for the C<Accept> request header or the C<Content-Type> response
header you can use L<Mojolicious/"types">.
Expand Down Expand Up @@ -673,7 +673,7 @@ This chain could go on and on to allow a very high level of template reuse.

=head2 Form validation

You can use L<Mojolicious::Controller/"validation"> to validate GET/POST
You can use L<Mojolicious::Controller/"validation"> to validate C<GET>/C<POST>
parameters submitted to your application. All unknown fields will be ignored
by default, so you have to decide which should be required or optional before
you can perform checks on their values. Every check is performed right away,
Expand Down
4 changes: 2 additions & 2 deletions lib/Mojolicious/Guides/Routing.pod
Expand Up @@ -514,7 +514,7 @@ methods to pass.
$r->route('/bye')->via('GET', 'POST')
->to(controller => 'foo', action => 'bye');

With one small exception, HEAD requests are considered equal to GET and
With one small exception, C<HEAD> requests are considered equal to C<GET> and
content will not be sent with the response.

# GET /test -> {controller => 'bar', action => 'test'}
Expand All @@ -525,7 +525,7 @@ content will not be sent with the response.
=head2 WebSockets

With the method L<Mojolicious::Routes::Route/"websocket"> you can restrict
access to WebSocket handshakes, which are normal GET requests with some
access to WebSocket handshakes, which are normal C<GET> requests with some
additional information.

# /echo (WebSocket handshake)
Expand Down
14 changes: 7 additions & 7 deletions lib/Mojolicious/Lite.pm
Expand Up @@ -172,7 +172,7 @@ L<Mojolicious::Controller/"render">, but more about that later.
=head2 GET/POST parameters
All GET and POST parameters sent with the request are accessible via
All C<GET> and C<POST> parameters sent with the request are accessible via
L<Mojolicious::Controller/"param">.
use Mojolicious::Lite;
Expand Down Expand Up @@ -1018,13 +1018,13 @@ The L<Mojolicious::Lite> application.
my $route = del '/:foo' => sub {...};
Generate route with L<Mojolicious::Routes::Route/"delete">, matching only
DELETE requests. See also the tutorial above for more argument variations.
C<DELETE> requests. See also the tutorial above for more argument variations.
=head2 get
my $route = get '/:foo' => sub {...};
Generate route with L<Mojolicious::Routes::Route/"get">, matching only GET
Generate route with L<Mojolicious::Routes::Route/"get">, matching only C<GET>
requests. See also the tutorial above for more argument variations.
=head2 group
Expand All @@ -1050,15 +1050,15 @@ Share code with L<Mojolicious/"hook">.
my $route = options '/:foo' => sub {...};
Generate route with L<Mojolicious::Routes::Route/"options">, matching only
OPTIONS requests. See also the tutorial above for more argument
C<OPTIONS> requests. See also the tutorial above for more argument
variations.
=head2 patch
my $route = patch '/:foo' => sub {...};
Generate route with L<Mojolicious::Routes::Route/"patch">, matching only
PATCH requests. See also the tutorial above for more argument variations.
C<PATCH> requests. See also the tutorial above for more argument variations.
=head2 plugin
Expand All @@ -1071,13 +1071,13 @@ Load a plugin with L<Mojolicious/"plugin">.
my $route = post '/:foo' => sub {...};
Generate route with L<Mojolicious::Routes::Route/"post">, matching only
POST requests. See also the tutorial above for more argument variations.
C<POST> requests. See also the tutorial above for more argument variations.
=head2 put
my $route = put '/:foo' => sub {...};
Generate route with L<Mojolicious::Routes::Route/"put">, matching only PUT
Generate route with L<Mojolicious::Routes::Route/"put">, matching only C<PUT>
requests. See also the tutorial above for more argument variations.
=head2 under
Expand Down
2 changes: 1 addition & 1 deletion lib/Mojolicious/Plugin/DefaultHelpers.pm
Expand Up @@ -131,7 +131,7 @@ L<Mojolicious::Plugin::DefaultHelpers> implements the following helpers.
%= accepts('html', 'json', 'txt') // 'html'
Select best possible representation for resource from C<Accept> request
header, C<format> stash value or C<format> GET/POST parameter with
header, C<format> stash value or C<format> C<GET>/C<POST> parameter with
L<Mojolicious::Renderer/"accepts">, defaults to returning the first extension
if no preference could be detected.
Expand Down
2 changes: 1 addition & 1 deletion lib/Mojolicious/Plugin/TagHelpers.pm
Expand Up @@ -405,7 +405,7 @@ Generate file input element.
% end
Generate portable form tag with L<Mojolicious::Controller/"url_for">. For
routes that allow POST but not GET, a C<method> attribute will be
routes that allow C<POST> but not C<GET>, a C<method> attribute will be
automatically added.
<form action="/path/to/login">
Expand Down
2 changes: 1 addition & 1 deletion lib/Mojolicious/Renderer.pm
Expand Up @@ -341,7 +341,7 @@ implements the following new ones.
my $best = $renderer->accepts(Mojolicious::Controller->new, 'html', 'json');
Select best possible representation for L<Mojolicious::Controller> object from
C<Accept> request header, C<format> stash value or C<format> GET/POST
C<Accept> request header, C<format> stash value or C<format> C<GET>/C<POST>
parameter, defaults to returning the first extension if no preference could be
detected. Since browsers often don't really know what they actually want,
unspecific C<Accept> request headers with more than one MIME type will be
Expand Down

0 comments on commit bb1a807

Please sign in to comment.