From: Tomas Doran Date: Sat, 27 Dec 2008 16:52:31 +0000 (+0000) Subject: Yet another 5.80 regression X-Git-Tag: 5.8000_05~71 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=commitdiff_plain;h=b1e0cb6d4ded3d4223517d4adce6caef23112946 Yet another 5.80 regression --- diff --git a/Changes b/Changes index ecf8006..d150d79 100644 --- a/Changes +++ b/Changes @@ -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) diff --git a/TODO b/TODO index 9c225aa..b304f69 100644 --- a/TODO +++ b/TODO @@ -9,6 +9,9 @@ Pending patches: 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 diff --git a/t/aggregate/live_engine_request_body.t b/t/aggregate/live_engine_request_body.t index f5c5066..0a6dea2 100644 --- a/t/aggregate/live_engine_request_body.t +++ b/t/aggregate/live_engine_request_body.t @@ -75,3 +75,19 @@ use HTTP::Request::Common; 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' ); +} + diff --git a/t/lib/Catalyst/Plugin/Test/Plugin.pm b/t/lib/Catalyst/Plugin/Test/Plugin.pm index 8440966..809a13a 100644 --- a/t/lib/Catalyst/Plugin/Test/Plugin.pm +++ b/t/lib/Catalyst/Plugin/Test/Plugin.pm @@ -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 @@ sub prepare { } +# 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) = @_; }