diff --git a/lib/Catalyst/Action/REST.pm b/lib/Catalyst/Action/REST.pm index f1bf410..9802d33 100644 --- a/lib/Catalyst/Action/REST.pm +++ b/lib/Catalyst/Action/REST.pm @@ -137,7 +137,7 @@ sub _get_allowed_methods { my ( $self, $controller, $c, $name ) = @_; my $class = ref($controller) ? ref($controller) : $controller; my $methods = Class::Inspector->methods($class); - return map { /^$name\_(.+)$/ } @$methods; + return map { /^$name\_([^[:lower:]]+)$/ } @$methods; }; sub _return_options { @@ -158,7 +158,8 @@ sub _return_not_implemented { $c->response->body( "Method " . $c->request->method . " not implemented for " - . $c->uri_for( $method_name ) ); + . $c->req->uri ); + $c->log->debug( "Not implemented for: " . $c->uri_for( $method_name ) ) if $c->debug; } __PACKAGE__->meta->make_immutable; diff --git a/t/catalyst-action-rest.t b/t/catalyst-action-rest.t index 324df80..fd30856 100644 --- a/t/catalyst-action-rest.t +++ b/t/catalyst-action-rest.t @@ -53,6 +53,14 @@ is( "not_implemented handler had proper response" ); +my $ni_def_res = request( $t->delete( url => '/default/not_implemented/a/b' ) ); +is( $ni_def_res->code, 405, "Default not_implemented handler succeeded" ); +like( + $ni_def_res->content, + qr|Method.*?http://.*?/default/not_implemented/a/b$|, + "Default not_implemented handler had proper path for response" +); + 1; done_testing; diff --git a/t/lib/Test/Catalyst/Action/REST/Controller/Root.pm b/t/lib/Test/Catalyst/Action/REST/Controller/Root.pm index b42ee24..4fdde1f 100644 --- a/t/lib/Test/Catalyst/Action/REST/Controller/Root.pm +++ b/t/lib/Test/Catalyst/Action/REST/Controller/Root.pm @@ -58,6 +58,13 @@ sub notreally_GET { $c->forward('ok'); } +sub notreally_TeSt : Local { + my ( $self, $c ) = @_; + + $c->stash->{'entity'} = "notreally test"; + $c->forward('ok'); +} + sub not_implemented : Local : ActionClass('REST') { } @@ -75,6 +82,9 @@ sub not_implemented_not_implemented { $c->forward('ok'); } +sub default_not_implemented : Path('/default/not_implemented') : Args(2) : ActionClass('REST') { +} + sub not_modified : Local : ActionClass('REST') { } sub not_modified_GET {