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