changed the way test dumping a request works
[catagits/Catalyst-Runtime.git] / t / lib / TestFromPSGI.pm
CommitLineData
952ff530 1package TestFromPSGI;
2
3use Moose;
4use Plack::Middleware::Static;
5use Plack::App::File;
6use Catalyst;
7
8extends 'Catalyst';
9
10my $static = Plack::Middleware::Static->new(
11 path => qr{^/static/}, root => TestMiddleware->path_to('share'));
12
13__PACKAGE__->config(
14 'Controller::Root', { namespace => '' },
15 'psgi_middleware', [
16 'Head',
17 $static,
18 'Static', { path => qr{^/static2/}, root => TestMiddleware->path_to('share') },
19 'Runtime',
20 '+TestMiddleware::Custom', { path => qr{^/static3/}, root => TestMiddleware->path_to('share') },
21 sub {
22 my $app = shift;
23 return sub {
24 my $env = shift;
25 if($env->{PATH_INFO} =~m/forced/) {
26 Plack::App::File->new(file=>TestMiddleware->path_to(qw/share static forced.txt/))
27 ->call($env);
28 } else {
29 return $app->($env);
30 }
31 },
32 },
33
34 ],
35);
36
37__PACKAGE__->setup;
38