Registry/IO/Simple.pm

filter: Statementstmt 70.8% 17 / 24 Branchbran 0.0% 0 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 83.3% 5 / 6 Podpod n/a totaltotal 61.1% 22 / 36 CC 4 SCAR 22.5
CC
4
Cov
57%
send_request
20.0
BEGIN
1.0
BEGIN
1.0
CRAP 9.4
« Registry/Auth/AzureServicePrincipal.pm ↑ Summary Registry/RequestBuilder.pm »
1 package Docker::Registry::IO::Simple;
2 1 ▶ use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 1 ▶ use Types::Standard qw/Bool/;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 with 'Docker::Registry::IO';
5  
6 1 ▶ use HTTP::Tiny;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 ▶ use Data::Dumper;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 1 has debug => (is => 'rw', isa => Bool, default => 0);
10  
11 1 ▶ has ua => (is => 'ro', default => sub {
Subroutine __ANON__: called CC=1 SCAR=0.0
12 1 HTTP::Tiny->new(
13 max_redirect => 0,
14 agent => 'Docker::Registry Perl client' . $Docker::Registry::VERSION,
15 timeout => 60,
16 );
17 1 });
18  
19 0 ▶ sub send_request {
Subroutine send_request: not called CC=4 SCAR=30.0
20 0 my ($self, $request) = @_;
21 0 my $headers = $request->header_hash;
22  
23 # HTTP::Tiny derives the Host header from the URL. It's an error to set it.
24 0 delete $headers->{Host};
25  
26 0 ▶ print Dumper($request) if ($self->debug);
Branch: 1 branch
BranchTrueFalseTotal
if $self->debug 0 0 0
27  
28 0 ▶ my $response = $self->ua->request(
Branch: 1 branch
BranchTrueFalseTotal
defined $request->content ? : 0 0 0
29 $request->method,
30 $request->url,
31 {
32 headers => $headers,
33 (defined $request->content)?(content => $request->content):(),
34 }
35 );
36 0 ▶ print Dumper($response) if ($self->debug);
Branch: 1 branch
BranchTrueFalseTotal
if $self->debug 0 0 0
37  
38 return Docker::Registry::Response->new(
39 status => $response->{status},
40 content => $response->{content},
41 headers => $response->{headers}
42 0 );
43 }
44  
45 1 1;
« Registry/Auth/AzureServicePrincipal.pm ↑ Summary Registry/RequestBuilder.pm »