X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=blobdiff_plain;f=t%2Flib%2FCatalyst%2FPlugin%2FTest%2FPlugin.pm;h=69341b784da8bc3e31157a195f66734697da6977;hp=09ee8f75d531b6de1306de253e3abfe6e9a9adf5;hb=bd7ed1deb4f291b5e5629a0dec5209240d8abb0f;hpb=19a24dbb5b7329841b77ce80102c85c6bb137dee diff --git a/t/lib/Catalyst/Plugin/Test/Plugin.pm b/t/lib/Catalyst/Plugin/Test/Plugin.pm index 09ee8f7..69341b7 100644 --- a/t/lib/Catalyst/Plugin/Test/Plugin.pm +++ b/t/lib/Catalyst/Plugin/Test/Plugin.pm @@ -1,16 +1,16 @@ package Catalyst::Plugin::Test::Plugin; - -use strict; -use warnings; +use Moose; use MRO::Compat; -use base qw/Catalyst::Base Class::Data::Inheritable/; +with 'Catalyst::ClassData'; __PACKAGE__->mk_classdata('ran_setup'); sub setup { my $c = shift; $c->ran_setup('1'); + + return $c->next::method( @_ ); } sub prepare { @@ -22,26 +22,15 @@ 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); - } -} - -sub end : Private { - my ($self,$c) = @_; +# 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(@_); } +no Moose; 1;