X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Flib%2FTestApp%2FController%2FHTTPMethods.pm;h=b78477589a428f1f2eadbc05275e068917f73120;hb=88e5a8b0c4d28e46b8ba6b6b9567063e57af9063;hp=e687372d8a482d930438ff9fca329fcf02f0da6a;hpb=f3a49d84c2fd58d504b1147de03e8da7a00fd755;p=catagits%2FCatalyst-Runtime.git diff --git a/t/lib/TestApp/Controller/HTTPMethods.pm b/t/lib/TestApp/Controller/HTTPMethods.pm index e687372..b784775 100644 --- a/t/lib/TestApp/Controller/HTTPMethods.pm +++ b/t/lib/TestApp/Controller/HTTPMethods.pm @@ -2,34 +2,44 @@ package TestApp::Controller::HTTPMethods; use Moose; use MooseX::MethodAttributes; - + extends 'Catalyst::Controller'; - + sub default : Path Args { my ($self, $ctx) = @_; $ctx->response->body('default'); } - + sub get : Path('foo') Method('GET') { my ($self, $ctx) = @_; $ctx->response->body('get'); } - + sub post : Path('foo') Method('POST') { my ($self, $ctx) = @_; $ctx->response->body('post'); } - + sub get_or_post : Path('bar') Method('GET') Method('POST') { my ($self, $ctx) = @_; $ctx->response->body('get or post'); } - + sub any_method : Path('baz') { my ($self, $ctx) = @_; $ctx->response->body('any'); } +sub typo_option : Path('opt_typo') OPTION { + my ($self, $ctx) = @_; + $ctx->response->body('typo'); +} + +sub real_options : Path('opt') OPTIONS { + my ($self, $ctx) = @_; + $ctx->response->body('options'); +} + sub base :Chained('/') PathPrefix CaptureArgs(0) { } sub chained_get :Chained('base') Args(0) GET { @@ -53,7 +63,7 @@ sub get_or_put :Chained('base') PathPart('get_put_post_delete') CaptureArgs(0) G sub get2 :Chained('get_or_put') PathPart('') Args(0) GET { pop->res->body('get2'); } - + sub put2 :Chained('get_or_put') PathPart('') Args(0) PUT { pop->res->body('put2'); } @@ -63,13 +73,17 @@ sub post_or_delete :Chained('base') PathPart('get_put_post_delete') CaptureArgs( sub post2 :Chained('post_or_delete') PathPart('') Args(0) POST { pop->res->body('post2'); } - + sub delete2 :Chained('post_or_delete') PathPart('') Args(0) DELETE { pop->res->body('delete2'); } sub check_default :Chained('base') CaptureArgs(0) { } +sub chain_default :Chained('check_default') PathPart('') Args(0) { + pop->res->body('chain_default'); +} + sub default_get :Chained('check_default') PathPart('') Args(0) GET { pop->res->body('get3'); } @@ -78,8 +92,6 @@ sub default_post :Chained('check_default') PathPart('') Args(0) POST { pop->res->body('post3'); } -sub chain_default :Chained('check_default') PathPart('') Args(0) { - pop->res->body('chain_default'); -} + __PACKAGE__->meta->make_immutable;