Reproxy/Furl.pm

filter: Statementstmt 100% 24 / 24 Branchbran 50.0% 1 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 6 / 6 Podpod 50.0% 1 / 2 totaltotal 94.1% 32 / 34 CC 2 SCAR 2.6
CC
2
Cov
96%
prepare_app
2.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.3
« Reproxy.pm ↑ Summary Reproxy/Callback.pm »
1 package Plack::Middleware::Reproxy::Furl;
2 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 1 ▶use parent qw(Plack::Middleware::Reproxy);
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use Plack::Util::Accessor qw(furl);
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use Furl::HTTP;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 1 ▶sub prepare_app {
Subroutine prepare_app: called CC=2 SCAR=7.0
Pod documented
8 1 my $self = shift;
9 1 ▶ if (! $self->furl) {
Branch: 1 branch
BranchTrueFalseTotal
if (not $self->furl) 1 0 1
10 1 my $furl = Furl::HTTP->new;
11 1 $self->furl($furl);
12 }
13 }
14  
15 2 ▶sub reproxy_to {
Subroutine reproxy_to: called CC=1 SCAR=0.0
Pod undocumented
16 2 my ($self, $res, $env, $url) = @_;
17  
18 # Now recreate headers
19 2 my @hdrs = $self->extract_headers($env);
20  
21 2 my $input = $env->{'psgi.input'};
22 2 $input->seek(0, 0);
23 my @args = (
24 method => $env->{HTTP_METHOD},
25 2 url => $url,
26 headers => \@hdrs,
27 content => $input,
28 );
29 2 my (undef, $code, undef, $hdrs, $body) = $self->furl->request(@args);
30  
31 2 @$res = ( $code, $hdrs, [ $body ] );
32 }
33  
34 1 1;
35  
36 __END__
« Reproxy.pm ↑ Summary Reproxy/Callback.pm »