File Coverage

blib/lib/Plack/Middleware/RearrangeHeaders.pm
Criterion Covered Total %
statement 22 22 100.0
branch n/a
condition n/a
subroutine 6 6 100.0
pod 1 1 100.0
total 29 29 100.0


line stmt bran cond sub pod time code
1             package Plack::Middleware::RearrangeHeaders;
2 1     1   5 use strict;
  1         2  
  1         34  
3 1     1   3 use warnings;
  1         1  
  1         66  
4 1     1   4 use parent qw( Plack::Middleware );
  1         2  
  1         9  
5              
6 1     1   533 use HTTP::Headers;
  1         4572  
  1         193  
7              
8             sub call {
9 1     1 1 2 my $self = shift;
10              
11 1         5 my $res = $self->app->(@_);
12             $self->response_cb($res, sub {
13 1     1   2 my $res = shift;
14              
15 1         1 my $h = HTTP::Headers->new(@{$res->[1]});
  1         4  
16 1         92 my @new_headers;
17 1         5 $h->scan(sub { push @new_headers, @_ });
  3         34  
18              
19 1         7 $res->[1] = \@new_headers;
20 1         15 });
21             }
22              
23             1;
24              
25             __END__