prepare_action is in context (t/aggregate/live_engine_request_body.t)
Zbigniew Łukasiak [Wed, 18 Nov 2009 07:00:22 +0000 (07:00 +0000)]
t/lib/Catalyst/Plugin/Test/Plugin.pm
t/lib/Catalyst/TraitFor/Context/TestPluginServer.pm [new file with mode: 0644]
t/lib/TestApp/Context.pm

index 16f3f63..d3c2e37 100644 (file)
@@ -22,14 +22,5 @@ sub prepare {
     return $c;
 }
 
-# Note: Catalyst::Plugin::Server forces the body to
-#       be parsed, by calling the $c->req->body method in prepare_action.
-#       We need to test this, as this was broken by 5.80. See also
-#       t/aggregate/live_engine_request_body.t.
-sub prepare_action {
-    my $c = shift;
-    $c->res->header('X-Have-Request-Body', 1) if $c->req->body;
-    $c->next::method(@_);
-}
 
 1;
diff --git a/t/lib/Catalyst/TraitFor/Context/TestPluginServer.pm b/t/lib/Catalyst/TraitFor/Context/TestPluginServer.pm
new file mode 100644 (file)
index 0000000..0907aea
--- /dev/null
@@ -0,0 +1,15 @@
+package Catalyst::TraitFor::Context::TestPluginServer;
+
+use Moose::Role;
+
+# Note: Catalyst::Plugin::Server forces the body to
+#       be parsed, by calling the $c->req->body method in prepare_action.
+#       We need to test this, as this was broken by 5.80. See also
+#       t/aggregate/live_engine_request_body.t.
+
+after prepare_action => sub {
+    my $c = shift;
+    $c->res->header('X-Have-Request-Body', 1) if $c->req->body;
+};
+
+1;
index 5121fc8..38e4bb8 100644 (file)
@@ -1,8 +1,9 @@
 package TestApp::Context;
 use Moose;
 extends 'Catalyst::Context'; 
-with 'Catalyst::TraitFor::Context::TestHeaders';
-with 'Catalyst::TraitFor::Context::TestErrors';
+with 'Catalyst::TraitFor::Context::TestHeaders',
+     'Catalyst::TraitFor::Context::TestErrors',
+     'Catalyst::TraitFor::Context::TestPluginServer';
 
 if (eval { Class::MOP::load_class('CatalystX::LeakChecker'); 1 }) {
     with 'CatalystX::LeakChecker';