Small fixes
[catagits/Catalyst-Plugin-SubRequest.git] / t / lib / TestApp / Controller / Root.pm
1 package TestApp::Controller::Root;
2 use strict;
3 use warnings;
4
5 use base qw/Catalyst::Controller/;
6
7 sub begin : Private {
8     my ( $self, $c ) = @_;
9     $c->res->body('1');
10 }
11
12 sub subtest : Global {
13     my ( $self, $c ) = @_;
14     my $subreq= $c->res->body().
15                 $c->subreq('/normal/4');
16     $c->res->body($subreq);
17 }
18
19 sub normal : Global {
20     my ( $self, $c, $arg ) = @_;
21     $c->res->body($c->res->body().$arg);
22 }
23
24 sub subtest_params : Global {
25     my ( $self, $c ) = @_;
26     my $before = $c->req->params->{value};
27     my $subreq = $c->subreq('/normal/2');
28     my $after = $c->req->params->{value};
29     $c->res->body($c->res->body().$after);
30 }
31
32 sub subtest_full_response : Global {
33     my ( $self, $c ) = @_;
34     my $subreq_res = $c->subreq_res('/typesetter');
35     $c->res->body( $c->res->body() . $subreq_res->content_type );
36 }
37
38 sub typesetter : Global {
39     my ( $self, $c, $arg ) = @_;
40     $c->res->content_type( 'text/csv' );
41     $c->res->body($c->res->body());
42 }
43
44 sub end : Private {
45     my ( $self, $c ) = @_;
46     $c->res->body($c->res->body().'3');
47 }
48
49 1;
50