1Catalyst::TraitFor::ReqUuseesrt:C:oRnEtSrTi(b3u)ted PerlCaDtoacluymsetn:t:aTtriaointFor::Request::REST(3)
2
3
4

NAME

6       Catalyst::TraitFor::Request::REST - A role to apply to
7       Catalyst::Request giving it REST methods and attributes.
8

SYNOPSIS

10            if ( $c->request->accepts('application/json') ) {
11                ...
12            }
13
14            my $types = $c->request->accepted_content_types();
15

DESCRIPTION

17       This is a Moose::Role applied to Catalyst::Request that adds a few
18       methods to the request object to facilitate writing REST-y code.
19       Currently, these methods are all related to the content types accepted
20       by the client and the content type sent in the request.
21

METHODS

23       data
24           If the request went through the Deserializer action, this method
25           will return the deserialized data structure.
26
27       accepted_content_types
28           Returns an array reference of content types accepted by the client.
29
30           The list of types is created by looking at the following sources:
31
32           ·       Content-type header
33
34                   If this exists, this will always be the first type in the
35                   list.
36
37           ·       content-type parameter
38
39                   If the request is a GET request and there is a "content-
40                   type" parameter in the query string, this will come before
41                   any types in the Accept header.
42
43           ·       Accept header
44
45                   This will be parsed and the types found will be ordered by
46                   the relative quality specified for each type.
47
48           If a type appears in more than one of these places, it is ordered
49           based on where it is first found.
50
51       preferred_content_type
52           This returns the first content type found. It is shorthand for:
53
54             $request->accepted_content_types->[0]
55
56       accepts($type)
57           Given a content type, this returns true if the type is accepted.
58
59           Note that this does not do any wildcard expansion of types.
60

AUTHORS

62       See Catalyst::Action::REST for authors.
63

LICENSE

65       You may distribute this code under the same terms as Perl itself.
66
67
68
69perl v5.30.0                      2019-07-2C6atalyst::TraitFor::Request::REST(3)
Impressum