Commit | Line | Data |
7656dd12 |
1 | package Test::Catalyst::Action::REST::Controller::Actions; |
2 | use strict; |
3 | use warnings; |
4 | |
5 | use base qw/Catalyst::Controller::REST/; |
6 | |
7 | __PACKAGE__->config( namespace => 'actions' ); |
8 | |
9 | sub begin {} # Don't need serialization.. |
10 | |
11 | sub test : Local : ActionClass('REST') { |
12 | my ( $self, $c ) = @_; |
13 | $c->stash->{'entity'} = 'something'; |
14 | } |
15 | |
07b2ce27 |
16 | sub test_GET : Private ActionClass('+Test::Action::Class') { |
7656dd12 |
17 | my ( $self, $c ) = @_; |
18 | |
19 | $c->stash->{'entity'} .= " GET"; |
20 | $c->forward('ok'); |
21 | } |
22 | |
23 | sub test_POST :ActionClass('+Test::Action::Class') { |
24 | my ( $self, $c ) = @_; |
25 | |
26 | $c->stash->{'entity'} .= " POST"; |
27 | $c->forward('ok'); |
28 | } |
29 | |
30 | sub test_PUT :ActionClass('+Test::Action::Class') { |
31 | my ( $self, $c ) = @_; |
32 | |
33 | $c->stash->{'entity'} .= " PUT"; |
34 | $c->forward('ok'); |
35 | } |
36 | |
37 | sub test_DELETE :ActionClass('+Test::Action::Class') { |
38 | my ( $self, $c ) = @_; |
39 | $c->stash->{'entity'} .= " DELETE"; |
40 | $c->forward('ok'); |
41 | } |
42 | |
43 | sub test_OPTIONS :ActionClass('+Test::Action::Class') { |
44 | my ( $self, $c ) = @_; |
45 | |
46 | $c->stash->{'entity'} .= " OPTIONS"; |
47 | $c->forward('ok'); |
48 | } |
49 | |
50 | sub notreally : Local : ActionClass('REST') { |
51 | } |
52 | |
53 | sub notreally_GET :ActionClass('+Test::Action::Class') { |
54 | my ( $self, $c ) = @_; |
55 | |
56 | $c->stash->{'entity'} = "notreally GET"; |
57 | $c->forward('ok'); |
58 | } |
59 | |
60 | sub not_implemented : Local : ActionClass('REST') { |
61 | } |
62 | |
63 | sub not_implemented_GET :ActionClass('+Test::Action::Class') { |
64 | my ( $self, $c ) = @_; |
65 | |
66 | $c->stash->{'entity'} = "not_implemented GET"; |
67 | $c->forward('ok'); |
68 | } |
69 | |
70 | sub not_implemented_not_implemented :ActionClass('+Test::Action::Class') { |
71 | my ( $self, $c ) = @_; |
72 | |
73 | $c->stash->{'entity'} = "Not Implemented Handler"; |
74 | $c->forward('ok'); |
75 | } |
76 | |
77 | sub not_modified : Local : ActionClass('REST') { } |
78 | |
79 | sub not_modified_GET { |
80 | my ( $self, $c ) = @_; |
81 | $c->res->status(304); |
82 | return 1; |
83 | } |
84 | |
85 | sub ok : Private { |
86 | my ( $self, $c ) = @_; |
87 | |
88 | $c->res->content_type('text/plain'); |
89 | $c->res->body( $c->stash->{'entity'} ); |
90 | } |
91 | |
92 | sub end : Private {} # Don't need serialization.. |
93 | |
94 | 1; |
95 | |