prepare_action is in context (t/aggregate/live_engine_request_body.t)
[catagits/Catalyst-Runtime.git] / t / lib / Catalyst / TraitFor / Context / TestPluginServer.pm
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;