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 $method (qw(GET DELETE POST PUT OPTIONS)) {
15 my $run_method = lc($method);
16 my $result = "something $method";
18 if ( grep /$method/, qw(GET DELETE OPTIONS) ) {
19 $res = request( $t->$run_method( url => '/test' ) );
28 ok( $res->is_success, "$method request succeeded" );
32 "$method request had proper response"
36 my $fail_res = request( $t->delete( url => '/notreally' ) );
37 is( $fail_res->code, 405, "Request to bad method gets 405 Not Implemented" );
38 is( $fail_res->header('allow'), "GET", "405 allow header properly set." );
40 my $options_res = request( $t->options( url => '/notreally' ) );
41 is( $options_res->code, 200, "OPTIONS request handler succeeded" );
42 is( $options_res->header('allow'),
43 "GET", "OPTIONS request allow header properly set." );
45 my $modified_res = request( $t->get( url => '/not_modified' ) );
46 is( $modified_res->code, 304, "Not Modified request handler succeeded" );
48 my $ni_res = request( $t->delete( url => '/not_implemented' ) );
49 is( $ni_res->code, 200, "Custom not_implemented handler succeeded" );
52 "Not Implemented Handler",
53 "not_implemented handler had proper response"