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
|
6
|
|
|
6
|
|
26
|
use Moo; |
|
6
|
|
|
|
|
8
|
|
|
6
|
|
|
|
|
30
|
|
5
|
|
|
|
|
|
|
extends 'HTTP::Response'; |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
use overload |
8
|
6
|
|
|
|
|
57
|
'@{}' => \&finalize, |
9
|
|
|
|
|
|
|
'""' => \&to_string, |
10
|
6
|
|
|
6
|
|
1520
|
fallback => 1; |
|
6
|
|
|
|
|
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
|
13
|
|
|
13
|
0
|
22595
|
my $class = shift; |
35
|
13
|
|
|
|
|
34
|
my ( $rc, $message, $headers, $body ) = @_; |
36
|
13
|
|
|
|
|
101
|
return ( $rc, $message, $headers, $body ); |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
|
40
|
0
|
|
|
0
|
1
|
0
|
sub env { shift->request->env } |
41
|
8
|
|
|
8
|
1
|
759
|
sub content_type { shift->headers->content_type(@_) } |
42
|
8
|
|
|
8
|
1
|
1159
|
sub content_length { shift->headers->content_length(@_) } |
43
|
0
|
|
|
0
|
1
|
0
|
sub location { shift->headers->header( 'Location' => @_ ) } |
44
|
8
|
|
|
8
|
1
|
36029
|
sub header { shift->headers->header(@_) } |
45
|
8
|
|
|
8
|
0
|
2202
|
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__ |