| 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
Condition0%0/3
@args == 1 and $args[0]->$_isa("HTTP::Request")
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")
| |||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||
| 24 | 0 | ▶ | $options->{content} = $req->content if length($req->content); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 25 | 0 | ▶ | @args = ( | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 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__ | ||||||||||||||||||||||||||||