[Catalyst] Error in subclassing Catalyst::Controller::DBIC::API::REST

Amiri Barksdale amiribarksdale at gmail.com
Wed Jun 24 00:39:34 GMT 2009

I have a controller inheriting from a ControllerBase class that contains
the following:

   package RestTest::ControllerBase::REST;

   use strict;
   use warnings;
   use base qw/Catalyst::Controller::DBIC::API::REST/;

   sub create :Private {
   my ($self, $c) = @_;
       if ($c->stash->{created_object}) {    
           %{$c->stash->{response}->{new_object}} =


All the ControllerBase does is stash that object on create requests. I
was following lukes's example at
The relevant part of the controller is:

   package RestTest::Controller::API::REST::Artist;

   use strict;
   use warnings;
   use base qw/RestTest::ControllerBase::REST/;
   use JSON::Syck;

       action                  =>  { setup => { PathPart => 'artist',
   Chained => '/api/rest/rest_base' } },

Now for the problem. When I go to test this:

   my $mech = Test::WWW::Mechanize::Catalyst->new;
   ok(my $schema = DBICTest->init_schema(), 'got schema');

     my $req = GET("http://localhost/api/rest/artist/list", {
     }, 'Accept' => 'text/x-json' );
     cmp_ok( $mech->status, '==', 200, 'open attempt okay' );

I get the error:

   'Method GET not implemented for http' =>

Somehow my request path gets all messed up. I dumped out the $mech, and it tells
me that $mech->base is indeed what I put. So is $mech->redirected_uri.


More information about the Catalyst mailing list