6 use lib ( "$FindBin::Bin/lib", "$FindBin::Bin/../lib" );
9 # Should use the default serializer, YAML
10 my $t = Test::Rest->new( 'content_type' => 'text/plain' );
12 use_ok 'Catalyst::Test', 'Test::Catalyst::Action::REST';
14 foreach my $endpoint (qw/ test other_test /) {
15 foreach my $method (qw(GET DELETE POST PUT OPTIONS)) {
16 my $run_method = lc($method);
18 if ( grep /$method/, qw(GET DELETE OPTIONS) ) {
19 $res = request( $t->$run_method( url => '/actions/' . $endpoint ) );
24 url => '/actions/' . $endpoint,
29 ok( $res->is_success, "$method request succeeded" ) or warn Dumper($res);
33 "$method request had proper response"
36 $res->header('X-Was-In-TopLevel'),
38 "went through top level action for dispatching to $method"
41 $res->header('Using-Action'),
43 "went through action for dispatching to $method"
48 my $head_res = request( $t->head(url => '/actions/test') );
49 ok($head_res->is_success, 'HEAD request succeeded')
50 or diag($head_res->code);
51 ok(!$head_res->content, 'HEAD request had proper response');
55 url => '/actions/test',
60 $res->header('Using-Action'),
62 "went through action for dispatching to PUT"
65 $res->header('Using-Sub-Action'),
67 "went through sub action for dispatching to PUT"