[Catalyst-commits] r11071 - in
Catalyst-Runtime/5.80/branches/deprecate_appclass_actions/t:
aggregate lib/Catalyst/Plugin/Test
yousef at dev.catalyst.perl.org
yousef at dev.catalyst.perl.org
Mon Aug 10 04:04:14 GMT 2009
Author: yousef
Date: 2009-08-10 04:04:13 +0000 (Mon, 10 Aug 2009)
New Revision: 11071
Modified:
Catalyst-Runtime/5.80/branches/deprecate_appclass_actions/t/aggregate/live_engine_request_body.t
Catalyst-Runtime/5.80/branches/deprecate_appclass_actions/t/lib/Catalyst/Plugin/Test/Plugin.pm
Log:
prepare_action() fix by t0m (removed closure)
Modified: Catalyst-Runtime/5.80/branches/deprecate_appclass_actions/t/aggregate/live_engine_request_body.t
===================================================================
--- Catalyst-Runtime/5.80/branches/deprecate_appclass_actions/t/aggregate/live_engine_request_body.t 2009-08-09 14:22:21 UTC (rev 11070)
+++ Catalyst-Runtime/5.80/branches/deprecate_appclass_actions/t/aggregate/live_engine_request_body.t 2009-08-10 04:04:13 UTC (rev 11071)
@@ -80,13 +80,13 @@
# 5.80 regression, see note in Catalyst::Plugin::Test::Plugin
{
my $request = GET(
- 'http://localhost/have_req_body_in_prepare_action',
+ 'http://localhost/dump/response',
'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' );
+ ok( $response->header('X-Have-Request-Body'), 'X-Have-Request-Body set' );
}
Modified: Catalyst-Runtime/5.80/branches/deprecate_appclass_actions/t/lib/Catalyst/Plugin/Test/Plugin.pm
===================================================================
--- Catalyst-Runtime/5.80/branches/deprecate_appclass_actions/t/lib/Catalyst/Plugin/Test/Plugin.pm 2009-08-09 14:22:21 UTC (rev 11070)
+++ Catalyst-Runtime/5.80/branches/deprecate_appclass_actions/t/lib/Catalyst/Plugin/Test/Plugin.pm 2009-08-10 04:04:13 UTC (rev 11071)
@@ -22,22 +22,14 @@
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 {
More information about the Catalyst-commits
mailing list