File Coverage

blib/lib/Plack/Middleware/LowerUrl.pm
Criterion Covered Total %
statement 19 19 100.0
branch 3 6 50.0
condition n/a
subroutine 5 5 100.0
pod 1 1 100.0
total 28 31 90.3


line stmt bran cond sub pod time code
1 1     1   958 use strict;
  1         2  
  1         44  
2 1     1   6 use warnings;
  1         2  
  1         63  
3             package Plack::Middleware::LowerUrl;
4             BEGIN {
5 1     1   40 $Plack::Middleware::LowerUrl::AUTHORITY = 'cpan:LOGIE';
6             }
7             {
8             $Plack::Middleware::LowerUrl::VERSION = '0.01';
9             }
10 1     1   5 use parent qw( Plack::Middleware );
  1         2  
  1         10  
11              
12             sub call {
13 3     3 1 31305 my ($self, $env) = @_;
14 3 50       10 if ( $env->{REQUEST_URI} ) {
15 3         11 my ($path, $params) = split(/\?/, $env->{REQUEST_URI});
16 3         6 $path = lc $path;
17 3         8 $env->{REQUEST_URI} = join('?', $path, $params);
18             }
19 3 50       9 if ( $env->{PATH_INFO} ) {
20 3 50       10 $env->{PATH_INFO} = lc $env->{PATH_INFO} if $env->{PATH_INFO};
21             }
22 3         28 my $res = $self->app->($env);
23 3         1944 return $res;
24             }
25              
26             1;
27              
28             __END__