f4f835b67eb58472bb83e4d4f6a1050018a22b69
[catagits/Catalyst-Runtime.git] / t / lib / Catalyst / Plugin / Test / Plugin.pm
1 package Catalyst::Plugin::Test::Plugin;
2
3 use strict;
4 use warnings;
5 use MRO::Compat;
6
7 use base qw/Class::Data::Inheritable/;
8
9  __PACKAGE__->mk_classdata('ran_setup');
10
11 sub setup {
12    my $c = shift;
13    $c->ran_setup('1');
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 1;