line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Net::HTTP::Knork::Response; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
# ABSTRACT: Portable HTTP Response object for SPORE response |
4
|
5
|
|
|
5
|
|
21
|
use Moo; |
|
5
|
|
|
|
|
6
|
|
|
5
|
|
|
|
|
23
|
|
5
|
|
|
|
|
|
|
extends 'HTTP::Response'; |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
use overload |
8
|
5
|
|
|
|
|
47
|
'@{}' => \&finalize, |
9
|
|
|
|
|
|
|
'""' => \&to_string, |
10
|
5
|
|
|
5
|
|
1314
|
fallback => 1; |
|
5
|
|
|
|
|
8
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
has 'body' => ( |
14
|
|
|
|
|
|
|
is => 'rw', |
15
|
|
|
|
|
|
|
lazy => 1, |
16
|
|
|
|
|
|
|
builder => sub { |
17
|
0
|
|
|
0
|
|
0
|
return $_[0]->content; |
18
|
|
|
|
|
|
|
}, |
19
|
|
|
|
|
|
|
trigger => sub { |
20
|
|
|
|
|
|
|
my ( $self, $body_new_value ) = @_; |
21
|
|
|
|
|
|
|
$self->raw_body($body_new_value); |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
); |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
has 'raw_body' => ( |
26
|
|
|
|
|
|
|
is => 'rw', |
27
|
|
|
|
|
|
|
); |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
has 'request' => ( |
30
|
|
|
|
|
|
|
is => 'rw', |
31
|
|
|
|
|
|
|
); |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub FOREIGNBUILDARGS { |
34
|
9
|
|
|
9
|
0
|
15295
|
my $class = shift; |
35
|
9
|
|
|
|
|
24
|
my ( $rc, $message, $headers, $body ) = @_; |
36
|
9
|
|
|
|
|
64
|
return ( $rc, $message, $headers, $body ); |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
|
40
|
0
|
|
|
0
|
1
|
0
|
sub env { shift->request->env } |
41
|
5
|
|
|
5
|
1
|
489
|
sub content_type { shift->headers->content_type(@_) } |
42
|
5
|
|
|
5
|
1
|
801
|
sub content_length { shift->headers->content_length(@_) } |
43
|
0
|
|
|
0
|
1
|
0
|
sub location { shift->header->header( 'Location' => @_ ) } |
44
|
5
|
|
|
5
|
1
|
30656
|
sub header { shift->headers->header(@_) } |
45
|
5
|
|
|
5
|
0
|
1499
|
sub to_string { shift->as_string } |
46
|
0
|
|
|
0
|
1
|
|
sub status { shift->code(@_) } |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
sub finalize { |
50
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
51
|
|
|
|
|
|
|
return [ |
52
|
0
|
|
|
|
|
|
$self->status, |
53
|
|
|
|
|
|
|
+[ map { |
54
|
0
|
|
|
|
|
|
my $k = $_; |
55
|
0
|
|
|
|
|
|
map { ( $k => $_ ) } $self->headers->header($_); |
|
0
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
} $self->headers->header_field_names |
57
|
|
|
|
|
|
|
], |
58
|
|
|
|
|
|
|
$self->body, |
59
|
|
|
|
|
|
|
]; |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
1; |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
__END__ |