whitespace cleanup
[catagits/Catalyst-Runtime.git] / t / lib / TestContentNegotiation / Controller / Root.pm
CommitLineData
982d7488 1package TestContentNegotiation::Controller::Root;
2
3use Moose;
4use MooseX::MethodAttributes;
5
6extends 'Catalyst::Controller';
7
8sub start :Chained(/) PathPrefix CaptureArgs(0) { }
9
32d4a56f 10 sub is_json : Chained('start') PathPart('') Consumes('application/json') Args(0) { pop->res->body('is_json1') }
11 sub is_urlencoded : Chained('start') PathPart('') Consumes('application/x-www-form-urlencoded') Args(0) { pop->res->body('is_urlencoded1') }
12 sub is_multipart : Chained('start') PathPart('') Consumes('multipart/form-data') Args(0) { pop->res->body('is_multipart1') }
88e5a8b0 13
982d7488 14 sub under :Chained('start') CaptureArgs(0) { }
15
32d4a56f 16 sub is_json_under : Chained('under') PathPart('') Consumes(JSON) Args(0) { pop->res->body('is_json2') }
17 sub is_urlencoded_under : Chained('under') PathPart('') Consumes(UrlEncoded) Args(0) { pop->res->body('is_urlencoded2') }
18 sub is_multipart_under : Chained('under') PathPart('') Consumes(Multipart) Args(0) { pop->res->body('is_multipart2') }
982d7488 19
20 ## Or allow more than one type
88e5a8b0 21
32d4a56f 22 sub multi :Chained('start') PathPart('') CaptureArgs(0) { }
88e5a8b0 23
982d7488 24 sub is_more_than_one_1
88e5a8b0 25 : Chained('multi')
982d7488 26 : Consumes('application/x-www-form-urlencoded')
27 : Consumes('multipart/form-data')
28 : Args(0)
29 {
30 pop->res->body('formdata1');
31 }
32
33 sub is_more_than_one_2
88e5a8b0 34 : Chained('multi')
982d7488 35 : Consumes('HTMLForm')
36 : Args(0)
37 {
38 pop->res->body('formdata2');
39 }
40
41 sub is_more_than_one_3
88e5a8b0 42 : Chained('multi')
982d7488 43 : Consumes('application/x-www-form-urlencoded,multipart/form-data')
44 : Args(0)
45 {
46 pop->res->body('formdata3');
47 }
48
49
50__PACKAGE__->meta->make_immutable;