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"
        );

 view all matches for this distribution
 view release on metacpan -  search on metacpan

( run in 0.560 second using v1.00-cache-2.02-grep-82fe00e-cpan-4673cadbf75 )