whitespace cleanup
[catagits/Catalyst-Runtime.git] / t / lib / TestContentNegotiation / share / file.txt
CommitLineData
d15db19c 1package TestContentNegotiation::Controller::Root;
2
3use Moose;
4use MooseX::MethodAttributes;
5
6extends 'Catalyst::Controller';
7
8sub start :Chained(/) PathPrefix CaptureArgs(0) { }
9
10 sub is_json : Chained('start') PathPart('') Consumes('application/json') Args(0) { pop->res->body('is_json') }
11 sub is_urlencoded : Chained('start') PathPart('') Consumes('application/x-www-form-urlencoded') Args(0) { pop->res->body('is_urlencoded') }
12 sub is_multipart : Chained('start') PathPart('') Consumes('multipart/form-data') Args(0) { pop->res->body('is_multipart') }
88e5a8b0 13
d15db19c 14 sub under :Chained('start') CaptureArgs(0) { }
15
16 sub is_json_under : Chained('under') PathPart('') Consumes(JSON) Args(0) { pop->res->body('is_json') }
17 sub is_urlencoded_under : Chained('under') PathPart('') Consumes(UrlEncoded) Args(0) { pop->res->body('is_urlencoded') }
18 sub is_multipart_under : Chained('under') PathPart('') Consumes(Multipart) Args(0) { pop->res->body('is_multipart') }
19
20 ## Or allow more than one type
88e5a8b0 21
d15db19c 22 sub multi :Chained('start') CaptureArgs(0) { }
88e5a8b0 23
d15db19c 24 sub is_more_than_one_1
25 : Chained('multi') PathPart('')
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
34 : Chained('multi') PathPart('')
35 : Consumes('HTMLForm')
36 : Args(0)
37 {
38 pop->res->body('formdata2');
39 }
40
41 sub is_more_than_one_3
42 : Chained('multi') PathPart('')
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;