File Coverage

blib/lib/Docker/Registry/Request.pm
Criterion Covered Total %
statement 12 17 70.5
branch 1 2 50.0
condition n/a
subroutine 4 6 66.6
pod 0 2 0.0
total 17 27 62.9


line stmt bran cond sub pod time code
1             package Docker::Registry::Request;
2 5     5   38 use Moo;
  5         11  
  5         27  
3 5     5   1633 use Types::Standard qw/Str Maybe InstanceOf/;
  5         11  
  5         30  
4 5     5   6293 use HTTP::Headers;
  5         38986  
  5         1067  
5              
6             has headers => (is => 'ro', isa => InstanceOf['HTTP::Headers'], default => sub { HTTP::Headers->new });
7             has method => (is => 'ro', isa => Str, required => 1);
8             has url => (is => 'ro', isa => Str, required => 1);
9             has content => (is => 'ro', isa => Maybe[Str]);
10              
11             sub header_hash {
12 0     0 0 0 my $self = shift;
13 0         0 my $headers = {};
14 0     0   0 $self->headers->scan(sub { $headers->{ $_[0] } = $_[1] });
  0         0  
15 0         0 return $headers;
16             }
17              
18             sub header {
19 3     3 0 7 my ($self, $header, $value) = @_;
20 3 50       23 $self->headers->header($header, $value) if (defined $value);
21 3         173 return $self->headers->header($header);
22             }
23              
24             1;