1Catalyst::ActionRole::CUosnesrumCeosnCtornitbeuntte(d3C)PaetrallyDsotc:u:mAecnttiaotniRoonle::ConsumesContent(3)
2
3
4

NAME

6       Catalyst::ActionRole::ConsumesContent - Match on HTTP Request
7       Content-Type
8

SYNOPSIS

10           package MyApp::Web::Controller::MyController;
11
12           use base 'Catalyst::Controller';
13
14           sub start : POST Chained('/') CaptureArg(0) { ... }
15
16             sub is_json       : Chained('start') Consumes('application/json') { ... }
17             sub is_urlencoded : Chained('start') Consumes('application/x-www-form-urlencoded') { ... }
18             sub is_multipart  : Chained('start') Consumes('multipart/form-data') { ... }
19
20             ## Alternatively, for common types...
21
22             sub is_json       : Chained('start') Consume(JSON) { ... }
23             sub is_urlencoded : Chained('start') Consumes(UrlEncoded) { ... }
24             sub is_multipart  : Chained('start') Consumes(Multipart) { ... }
25
26             ## Or allow more than one type
27
28             sub is_more_than_one
29               : Chained('start')
30               : Consumes('application/x-www-form-urlencoded')
31               : Consumes('multipart/form-data')
32             {
33               ## ...
34             }
35
36             1;
37

DESCRIPTION

39       This is an action role that lets your Catalyst::Action match on the
40       content type of the incoming request.
41
42       Generally when there's a PUT or POST request, there's a request content
43       body with a matching MIME content type.  Commonly this will be one of
44       the types used with classic HTML forms
45       ('application/x-www-form-urlencoded' for example) but there's nothing
46       stopping you specifying any valid content type.
47
48       For matching purposes, we match strings but the casing is insensitive.
49

REQUIRES

51       This role requires the following methods in the consuming class.
52
53   match
54   match_captures
55       Returns 1 if the action matches the existing request and zero if not.
56

METHODS

58       This role defines the following methods
59
60   match
61   match_captures
62       Around method modifier that return 1 if the request content type
63       matches one of the allowed content types (see "http_methods") and zero
64       otherwise.
65
66   allowed_content_types
67       An array of strings that are the allowed content types for matching
68       this action.
69
70   can_consume
71       Boolean.  Does the current request match content type with what this
72       actionrole can consume?
73
74   list_extra_info
75       Add the accepted content type to the debug screen.
76

AUTHORS

78       Catalyst Contributors, see Catalyst.pm
79
81       This library is free software. You can redistribute it and/or modify it
82       under the same terms as Perl itself.
83
84
85
86perl v5.32.0                      2020-C0a7t-a2l8yst::ActionRole::ConsumesContent(3)
Impressum