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   10 use strict;
  1         2  
  1         47  
3 1     1   7 use warnings;
  1         2  
  1         117  
4 1     1   9 use parent qw( Plack::Middleware );
  1         3  
  1         8  
5              
6 1     1   730 use HTTP::Headers;
  1         7067  
  1         260  
7              
8             sub call {
9 1     1 1 2 my $self = shift;
10              
11 1         7 my $res = $self->app->(@_);
12             $self->response_cb($res, sub {
13 1     1   3 my $res = shift;
14              
15 1         2 my $h = HTTP::Headers->new(@{$res->[1]});
  1         5  
16 1         142 my @new_headers;
17 1         8 $h->scan(sub { push @new_headers, @_ });
  3         54  
18              
19 1         33 $res->[1] = \@new_headers;
20 1         17 });
21             }
22              
23             1;
24              
25             __END__