prepare_action() fix by t0m (removed closure)
[catagits/Catalyst-Runtime.git] / t / lib / Catalyst / Plugin / Test / Plugin.pm
index b620c5e..1d39c7b 100644 (file)
@@ -22,22 +22,14 @@ sub prepare {
     return $c;
 }
 
-# Note: This is horrible, but Catalyst::Plugin::Server forces the body to
+# 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. Better ways to test this
-#       appreciated if you have suggestions :)
-{
-    my $have_req_body = 0;
-    sub prepare_action {
-        my $c = shift;
-        $have_req_body++ if $c->req->body;
-        $c->next::method(@_);
-    }
-    sub have_req_body_in_prepare_action : Local {
-        my ($self, $c) = @_;
-        $c->res->body($have_req_body);
-    }
+#       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(@_);
 }
 
 sub end : Private {