update distar url
[catagits/Catalyst-Runtime.git] / t / lib / Catalyst / Plugin / Test / Plugin.pm
1 package Catalyst::Plugin::Test::Plugin;
2 use Moose;
3 use MRO::Compat;
4
5 with 'Catalyst::ClassData';
6
7  __PACKAGE__->mk_classdata('ran_setup');
8
9 sub setup {
10    my $c = shift;
11    $c->ran_setup('1');
12
13    return $c->next::method( @_ );
14 }
15
16 sub prepare {
17     my $class = shift;
18
19     my $c = $class->next::method(@_);
20     $c->response->header( 'X-Catalyst-Plugin-Setup' => $c->ran_setup );
21
22     return $c;
23 }
24
25 # Note: 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.
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(@_);
33 }
34
35 no Moose;
36 1;