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 | |
73722623 | 7 | use base qw/Class::Data::Inheritable/; |
fbcc39ad | 8 | |
9 | __PACKAGE__->mk_classdata('ran_setup'); | |
10 | ||
11 | sub setup { | |
12 | my $c = shift; | |
13 | $c->ran_setup('1'); | |
7cc51a2e | 14 | |
15 | return $c->next::method( @_ ); | |
fbcc39ad | 16 | } |
17 | ||
19a24dbb | 18 | sub prepare { |
fbcc39ad | 19 | my $class = shift; |
20 | ||
19a24dbb | 21 | my $c = $class->next::method(@_); |
fbcc39ad | 22 | $c->response->header( 'X-Catalyst-Plugin-Setup' => $c->ran_setup ); |
23 | ||
24 | return $c; | |
fbcc39ad | 25 | } |
26 | ||
a0821622 | 27 | # Note: Catalyst::Plugin::Server forces the body to |
b1e0cb6d | 28 | # be parsed, by calling the $c->req->body method in prepare_action. |
29 | # We need to test this, as this was broken by 5.80. See also | |
a0821622 | 30 | # t/aggregate/live_engine_request_body.t. |
31 | sub prepare_action { | |
32 | my $c = shift; | |
33 | $c->res->header('X-Have-Request-Body', 1) if $c->req->body; | |
34 | $c->next::method(@_); | |
b1e0cb6d | 35 | } |
36 | ||
fbcc39ad | 37 | 1; |