[Catalyst-commits] r8955 - in Catalyst-Runtime/5.80/trunk: . t/aggregate t/lib/Catalyst/Plugin/Test

t0m at dev.catalyst.perl.org t0m at dev.catalyst.perl.org
Sat Dec 27 16:52:32 GMT 2008


Author: t0m
Date: 2008-12-27 16:52:31 +0000 (Sat, 27 Dec 2008)
New Revision: 8955

Modified:
   Catalyst-Runtime/5.80/trunk/Changes
   Catalyst-Runtime/5.80/trunk/TODO
   Catalyst-Runtime/5.80/trunk/t/aggregate/live_engine_request_body.t
   Catalyst-Runtime/5.80/trunk/t/lib/Catalyst/Plugin/Test/Plugin.pm
Log:
Yet another 5.80 regression

Modified: Catalyst-Runtime/5.80/trunk/Changes
===================================================================
--- Catalyst-Runtime/5.80/trunk/Changes	2008-12-27 16:46:08 UTC (rev 8954)
+++ Catalyst-Runtime/5.80/trunk/Changes	2008-12-27 16:52:31 UTC (rev 8955)
@@ -1,11 +1,14 @@
 # This file documents the revision history for Perl extension Catalyst.
 
+        - Add TODO tests for calling $c->req->body from inside an overridden
+          prepare_action method in a plugin, as used by 
+          Catalyst::Plugin::Server (t0m)
         - Fix assignment to Catalyst::Dispatcher's preload_dispatch_types and
           postload_dispatch_types attributes - assigning a list should later 
           return a listref. Fixes Catalyst::Plugin::Server. (t0m)
           - Tests for this (t0m)
-        - Change streaming test to serve itself rather than 01use.t, making test
-          sync for engines easier (t0m)
+        - Change streaming test to serve itself rather than 01use.t, making 
+          test sync for engines easier (t0m)
         - Refactor capturing of $app from Catalyst::Controller into
           Catalyst::Component::Role::CaptureApp for easier reuse in other
           components (Florian Ragwitz)

Modified: Catalyst-Runtime/5.80/trunk/TODO
===================================================================
--- Catalyst-Runtime/5.80/trunk/TODO	2008-12-27 16:46:08 UTC (rev 8954)
+++ Catalyst-Runtime/5.80/trunk/TODO	2008-12-27 16:52:31 UTC (rev 8955)
@@ -9,6 +9,9 @@
   
 Back-compat investigation / known issues:
 
+  - Catalyst::Plugin::Server is still buggered in various ways..
+    - Fix TODO tests in t/aggregate/live_engine_request_body.t
+
   - Common engine test failures, look into and get tests into core.
 
   - CatalystX-Imports, Class::MOP doesn't consider anon subs in the symbol 

Modified: Catalyst-Runtime/5.80/trunk/t/aggregate/live_engine_request_body.t
===================================================================
--- Catalyst-Runtime/5.80/trunk/t/aggregate/live_engine_request_body.t	2008-12-27 16:46:08 UTC (rev 8954)
+++ Catalyst-Runtime/5.80/trunk/t/aggregate/live_engine_request_body.t	2008-12-27 16:52:31 UTC (rev 8955)
@@ -75,3 +75,19 @@
     is( $creq->content_length, $request->content_length,
         'Catalyst::Request Content-Length' );
 }
+
+# 5.80 regression, see note in Catalyst::Plugin::Test::Plugin
+TODO: {
+    local $TODO = 'On demand request body parsing in prepare_action broken';
+
+    my $request = GET(
+        'http://localhost/have_req_body_in_prepare_action',
+        'Content-Type' => 'text/plain',
+        'Content'      => 'x' x 100_000
+    );
+
+    ok( my $response = request($request), 'Request' );
+    ok( $response->is_success, 'Response Successful 2xx' );
+    like( $response->content, qr/^[1-9]/, 'Has body' );
+}
+

Modified: Catalyst-Runtime/5.80/trunk/t/lib/Catalyst/Plugin/Test/Plugin.pm
===================================================================
--- Catalyst-Runtime/5.80/trunk/t/lib/Catalyst/Plugin/Test/Plugin.pm	2008-12-27 16:46:08 UTC (rev 8954)
+++ Catalyst-Runtime/5.80/trunk/t/lib/Catalyst/Plugin/Test/Plugin.pm	2008-12-27 16:52:31 UTC (rev 8955)
@@ -1,6 +1,8 @@
 package Catalyst::Plugin::Test::Plugin;
 
 use strict;
+use warnings;
+use Class::C3;
 
 use base qw/Catalyst::Base Class::Data::Inheritable/;
 
@@ -25,6 +27,24 @@
 
 }
 
+# Note: This is horrible, but 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);
+    }
+}
+
 sub end : Private {
     my ($self,$c) = @_;
 }




More information about the Catalyst-commits mailing list