Knork/Response.pm

filter: Statementstmt 60.0% 18 / 30 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 50.0% 7 / 14 Podpod 66.6% 6 / 9 totaltotal 58.4% 31 / 53 CC 1 SCAR 4.1
CC
1
Cov
60%
__ANON__
2.0
_build_body
2.0
__ANON__
2.0
CRAP 1.5
« Knork/Role/Middleware.pm ↑ Summary
1 package Net::HTTP::Knork::Response;
2  
3 # ABSTRACT: Portable HTTP Response object for SPORE response
4 6 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 6 extends 'HTTP::Response';
6  
7 use overload
8 6 ▶ '@{}' => \&finalize,
Subroutine BEGIN: called CC=1 SCAR=0.0
9 '""' => \&to_string,
10 6 fallback => 1;
11  
12  
13 has 'body' => (
14 is => 'rw',
15 lazy => 1,
16 0 ▶ builder => sub {
Subroutine _build_body: not called CC=1 SCAR=6.9
Subroutine __ANON__: not called CC=1 SCAR=6.9
17 0 return $_[0]->content;
18 },
19 0 ▶ trigger => sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
20 0 my ( $self, $body_new_value ) = @_;
21 0 $self->raw_body($body_new_value);
22 }
23 6 );
24  
25 6 has 'raw_body' => (
26 is => 'rw',
27 );
28  
29 6 has 'request' => (
30 is => 'rw',
31 );
32  
33 13 ▶sub FOREIGNBUILDARGS {
Subroutine FOREIGNBUILDARGS: called CC=1 SCAR=0.0
Pod undocumented
34 13 my $class = shift;
35 13 my ( $rc, $message, $headers, $body ) = @_;
36 13 return ( $rc, $message, $headers, $body );
37 }
38  
39  
40 0 ▶sub env { shift->request->env }
Subroutine env: not called CC=1 SCAR=6.9
Pod documented
41 8 ▶sub content_type { shift->headers->content_type(@_) }
Subroutine content_type: called CC=1 SCAR=0.0
Pod documented
42 8 ▶sub content_length { shift->headers->content_length(@_) }
Subroutine content_length: called CC=1 SCAR=0.0
Pod documented
43 0 ▶sub location { shift->headers->header( 'Location' => @_ ) }
Subroutine location: not called CC=1 SCAR=6.9
Pod documented
44 8 ▶sub header { shift->headers->header(@_) }
Subroutine header: called CC=1 SCAR=0.0
Pod documented
45 8 ▶sub to_string { shift->as_string }
Subroutine to_string: called CC=1 SCAR=0.0
Pod undocumented
46 0 ▶sub status { shift->code(@_) }
Subroutine status: not called CC=1 SCAR=6.9
Pod documented
47  
48  
49 0 ▶sub finalize {
Subroutine finalize: not called CC=1 SCAR=6.9
Pod undocumented
50 0 my $self = shift;
51 return [
52 $self->status,
53 +[ map {
54 0 my $k = $_;
55 0 map { ( $k => $_ ) } $self->headers->header($_);
56 } $self->headers->header_field_names
57 ],
58 $self->body,
59 ];
60 }
61  
62 6 1;
63  
64 __END__
« Knork/Role/Middleware.pm ↑ Summary