Fixed bug where if encoding was set in the config file it wasn't used,
[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    return $c->next::method( @_ );
16 }
17
18 sub prepare {
19     my $class = shift;
20
21     my $c = $class->next::method(@_);
22     $c->response->header( 'X-Catalyst-Plugin-Setup' => $c->ran_setup );
23
24     return $c;
25 }
26
27 # Note: Catalyst::Plugin::Server forces the body to
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
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(@_);
35 }
36
37 1;