From: Zbigniew Łukasiak Date: Tue, 17 Nov 2009 16:11:03 +0000 (+0000) Subject: TraitFor headers X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=commitdiff_plain;h=04f7e630df122ac8975bec933ba9c1d90bed0e2b TraitFor headers --- diff --git a/t/lib/Catalyst/TraitFor/Context/TestHeaders.pm b/t/lib/Catalyst/TraitFor/Context/TestHeaders.pm new file mode 100644 index 0000000..aa691b5 --- /dev/null +++ b/t/lib/Catalyst/TraitFor/Context/TestHeaders.pm @@ -0,0 +1,11 @@ +package Catalyst::TraitFor::Context::TestHeaders; + +use Moose::Role; + +after prepare_action => sub{ + my $c = shift; + $c->res->header( 'X-Catalyst-Action' => $c->req->action ); +}; + +1; + diff --git a/t/lib/TestApp/Context.pm b/t/lib/TestApp/Context.pm index e3e8f75..22b43b0 100644 --- a/t/lib/TestApp/Context.pm +++ b/t/lib/TestApp/Context.pm @@ -1,6 +1,7 @@ package TestApp::Context; use Moose; extends 'Catalyst::Context'; +with 'Catalyst::TraitFor::Context::TestHeaders'; if (eval { Class::MOP::load_class('CatalystX::LeakChecker'); 1 }) { with 'CatalystX::LeakChecker'; @@ -51,10 +52,5 @@ sub execute { return $c->SUPER::execute(@_); } -after prepare_action => sub{ - my $c = shift; - $c->res->header( 'X-Catalyst-Action' => $c->req->action ); -}; - 1; diff --git a/t/lib/TestAppDoubleAutoBug/Context.pm b/t/lib/TestAppDoubleAutoBug/Context.pm index 6378a54..8e5bce4 100644 --- a/t/lib/TestAppDoubleAutoBug/Context.pm +++ b/t/lib/TestAppDoubleAutoBug/Context.pm @@ -51,10 +51,5 @@ sub execute { return $c->SUPER::execute(@_); } -after prepare_action => sub{ - my $c = shift; - $c->res->header( 'X-Catalyst-Action' => $c->req->action ); -}; - 1;