Catalyst-Action-REST
    
    
  
  
  
view release on metacpan or search on metacpan
t/catalyst-action-rest-action-dispatch.t view on Meta::CPAN
use FindBin;
use Data::Dumper;
use lib ( "$FindBin::Bin/lib", "$FindBin::Bin/../lib" );
use Test::Rest;
# Should use the default serializer, YAML
my $t = Test::Rest->new( 'content_type' => 'text/plain' );
use_ok 'Catalyst::Test', 'Test::Catalyst::Action::REST';
foreach my $endpoint (qw/ test other_test /) {
    foreach my $method (qw(GET DELETE POST PUT OPTIONS)) {
        my $run_method = lc($method);
        my $res;
        if ( grep /$method/, qw(GET DELETE OPTIONS) ) {
            $res = request( $t->$run_method( url => '/actions/' . $endpoint ) );
        }
        else {
            $res = request(
                $t->$run_method(
                    url  => '/actions/' . $endpoint,
                    data => '',
                )
            );
        }
        ok( $res->is_success, "$method request succeeded" ) or warn Dumper($res);
        is(
            $res->content,
            "$method",
            "$method request had proper response"
        );
( run in 0.492 second using v1.01-cache-2.11-cpan-c333fce770f )