blib/lib/HTTP/Thin.pm

filter: Statementstmt 63.6% 21 / 33 Branchbran 0.0% 0 / 8 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 75.0% 6 / 8 Podpod n/a totaltotal 50.0% 27 / 54 CC 6 SCAR 30.0
CC
6
Cov
48%
__ANON__
42.0
__ANON__
2.0
BEGIN
1.0
CRAP 20.0
↑ Summary
1 package HTTP::Thin;
2 1 $HTTP::Thin::VERSION = '0.006';
3 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 #ABSTRACT: A Thin Wrapper around HTTP::Tiny to play nice with HTTP::Message
6  
7 1 ▶use parent qw(HTTP::Tiny);
Subroutine BEGIN: called CC=1 SCAR=0.0
8 1 ▶use Safe::Isa;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 1 ▶use Class::Method::Modifiers;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 1 ▶use HTTP::Response;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 1 ▶use Hash::MultiValue;
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13  
14  
15 0 ▶around request => sub {
Subroutine __ANON__: not called CC=6 SCAR=37.4
16 0 my ($next, $self, @args) = @_;
17 0 ▶ if (@args == 1 && $args[0]->$_isa('HTTP::Request')) {
Branch: 1 branch
BranchTrueFalseTotal
if (@args == 1 and $args[0]->$_isa("HTTP::Request")) 0 0 0
Condition0%0/3
@args == 1 and $args[0]->$_isa("HTTP::Request")
!ll&&!rl&&r
000
MC/DC0%0/2
@args == 1 and $args[0]->$_isa("HTTP::Request")
@args == 1 $args[0]->$_isa("HTTP::Request")
Truth table0%0/3
A and B
A= @args == 1B= $args[0]->$_isa("HTTP::Request")
ABresult
0X0
100
111
18 0 my $req = shift @args;
19 0 my @headers;
20 0 ▶ $req->headers->scan(sub { push @headers, @_ });
Subroutine __ANON__: not called CC=1 SCAR=6.9
21
22 0 my $options = {};
23 0 ▶ $options->{headers} = Hash::MultiValue->new(@headers)->mixed if @headers;
Branch: 1 branch
BranchTrueFalseTotal
if @headers 0 0 0
24 0 ▶ $options->{content} = $req->content if length($req->content);
Branch: 1 branch
BranchTrueFalseTotal
if length $req->content 0 0 0
25 0 ▶ @args = (
Branch: 1 branch
BranchTrueFalseTotal
keys %$options ? : 0 0 0
26 $req->method,
27 $req->uri,
28 ( keys %$options ? $options : () ),
29 );
30 }
31 0 my $res = $self->$next(@args);
32 return HTTP::Response->new(
33 $res->{status},
34 $res->{reason},
35 [ Hash::MultiValue->from_mixed($res->{headers})->flatten ],
36 $res->{content},
37 0 );
38 1 };
39  
40 1 1;
41  
42 __END__
↑ Summary