Commit | Line | Data |
---|---|---|
fbcc39ad | 1 | package Catalyst::Plugin::Test::Plugin; |
bd7ed1de | 2 | use Moose; |
951bab6b | 3 | use MRO::Compat; |
fbcc39ad | 4 | |
bd7ed1de | 5 | with 'Catalyst::ClassData'; |
fbcc39ad | 6 | |
7 | __PACKAGE__->mk_classdata('ran_setup'); | |
8 | ||
9 | sub setup { | |
10 | my $c = shift; | |
11 | $c->ran_setup('1'); | |
7cc51a2e | 12 | |
13 | return $c->next::method( @_ ); | |
fbcc39ad | 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 | ||
a0821622 | 25 | # Note: Catalyst::Plugin::Server forces the body to |
b1e0cb6d | 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 | |
a0821622 | 28 | # t/aggregate/live_engine_request_body.t. |
29 | sub prepare_action { | |
30 | my $c = shift; | |
31 | $c->res->header('X-Have-Request-Body', 1) if $c->req->body; | |
32 | $c->next::method(@_); | |
b1e0cb6d | 33 | } |
34 | ||
bd7ed1de | 35 | no Moose; |
fbcc39ad | 36 | 1; |