Commit | Line | Data |
fbcc39ad |
1 | package Catalyst::Plugin::Test::Plugin; |
2 | |
3 | use strict; |
b1e0cb6d |
4 | use warnings; |
951bab6b |
5 | use MRO::Compat; |
fbcc39ad |
6 | |
01ba879f |
7 | use base qw/Catalyst::Base Class::Data::Inheritable/; |
fbcc39ad |
8 | |
9 | __PACKAGE__->mk_classdata('ran_setup'); |
10 | |
11 | sub setup { |
12 | my $c = shift; |
13 | $c->ran_setup('1'); |
14 | } |
15 | |
19a24dbb |
16 | sub prepare { |
fbcc39ad |
17 | my $class = shift; |
18 | |
19a24dbb |
19 | my $c = $class->next::method(@_); |
fbcc39ad |
20 | $c->response->header( 'X-Catalyst-Plugin-Setup' => $c->ran_setup ); |
21 | |
22 | return $c; |
fbcc39ad |
23 | } |
24 | |
b1e0cb6d |
25 | # Note: This is horrible, but Catalyst::Plugin::Server forces the body to |
26 | # be parsed, by calling the $c->req->body method in prepare_action. |
27 | # We need to test this, as this was broken by 5.80. See also |
28 | # t/aggregate/live_engine_request_body.t. Better ways to test this |
29 | # appreciated if you have suggestions :) |
30 | { |
31 | my $have_req_body = 0; |
32 | sub prepare_action { |
33 | my $c = shift; |
34 | $have_req_body++ if $c->req->body; |
35 | $c->next::method(@_); |
36 | } |
37 | sub have_req_body_in_prepare_action : Local { |
38 | my ($self, $c) = @_; |
39 | $c->res->body($have_req_body); |
40 | } |
41 | } |
42 | |
01ba879f |
43 | sub end : Private { |
44 | my ($self,$c) = @_; |
45 | } |
46 | |
fbcc39ad |
47 | 1; |