TraitFor headers
Zbigniew Łukasiak [Tue, 17 Nov 2009 16:11:03 +0000 (16:11 +0000)]
t/lib/Catalyst/TraitFor/Context/TestHeaders.pm [new file with mode: 0644]
t/lib/TestApp/Context.pm
t/lib/TestAppDoubleAutoBug/Context.pm

diff --git a/t/lib/Catalyst/TraitFor/Context/TestHeaders.pm b/t/lib/Catalyst/TraitFor/Context/TestHeaders.pm
new file mode 100644 (file)
index 0000000..aa691b5
--- /dev/null
@@ -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;
+
index e3e8f75..22b43b0 100644 (file)
@@ -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;
 
index 6378a54..8e5bce4 100644 (file)
@@ -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;