| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package HTTP::Engine::Interface::Test; |
|
2
|
|
|
|
|
|
|
use HTTP::Engine::Interface |
|
3
|
|
|
|
|
|
|
builder => 'NoEnv', |
|
4
|
|
|
|
|
|
|
writer => { |
|
5
|
|
|
|
|
|
|
attributes => { |
|
6
|
|
|
|
|
|
|
output_body_buffer => { |
|
7
|
|
|
|
|
|
|
is => 'rw', |
|
8
|
|
|
|
|
|
|
}, |
|
9
|
|
|
|
|
|
|
}, |
|
10
|
|
|
|
|
|
|
around => { |
|
11
|
|
|
|
|
|
|
finalize => sub { |
|
12
|
34
|
|
|
|
|
384
|
my $next = shift; |
|
13
|
34
|
|
|
|
|
77
|
my ( $self, $req, $res ) = @_; |
|
14
|
34
|
|
|
|
|
135
|
$self->output_body_buffer(''); |
|
15
|
34
|
|
|
|
|
168
|
$next->(@_); |
|
16
|
34
|
|
|
|
|
177
|
$res->body( $self->output_body_buffer ); |
|
17
|
34
|
|
|
|
|
202
|
$res->as_http_response; |
|
18
|
|
|
|
|
|
|
}, |
|
19
|
|
|
|
|
|
|
}, |
|
20
|
34
|
|
|
34
|
|
79
|
output_header => sub {}, |
|
21
|
|
|
|
|
|
|
write => sub { |
|
22
|
35
|
|
|
35
|
|
79
|
my($self, $buffer) = @_; |
|
23
|
35
|
100
|
|
|
|
576
|
Carp::carp("do not pass the utf8-string as HTTP-Response: '$buffer'") if Encode::is_utf8($buffer); |
|
24
|
35
|
|
|
|
|
324
|
$self->output_body_buffer( $self->output_body_buffer . $buffer ); |
|
25
|
|
|
|
|
|
|
}, |
|
26
|
|
|
|
|
|
|
} |
|
27
|
13
|
|
|
13
|
|
23975
|
; |
|
|
13
|
|
|
|
|
35
|
|
|
|
13
|
|
|
|
|
285
|
|
|
28
|
|
|
|
|
|
|
|
|
29
|
13
|
|
|
13
|
|
12034
|
use HTTP::Engine::Test::Request; |
|
|
13
|
|
|
|
|
44
|
|
|
|
13
|
|
|
|
|
387
|
|
|
30
|
13
|
|
|
13
|
|
103
|
use Carp (); |
|
|
13
|
|
|
|
|
28
|
|
|
|
13
|
|
|
|
|
189
|
|
|
31
|
13
|
|
|
13
|
|
13411
|
use Encode (); |
|
|
13
|
|
|
|
|
174063
|
|
|
|
13
|
|
|
|
|
2383
|
|
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub run { |
|
34
|
36
|
|
|
36
|
0
|
9415
|
my ( $self, $request, %args ) = @_; |
|
35
|
36
|
50
|
|
|
|
153
|
Carp::croak('missing request object') unless $request; |
|
36
|
36
|
50
|
|
|
|
176
|
Carp::croak('incorrect request object($request->uri() returns undef)') unless $request->uri; |
|
37
|
36
|
100
|
|
|
|
3028
|
if ($request->method eq 'POST') { |
|
38
|
9
|
100
|
|
|
|
195
|
Carp::carp('missing content-length header') unless defined $request->content_length; |
|
39
|
9
|
100
|
|
|
|
928
|
Carp::carp('missing content-type header') unless $request->content_type; |
|
40
|
|
|
|
|
|
|
} |
|
41
|
|
|
|
|
|
|
|
|
42
|
36
|
|
|
|
|
1173
|
return $self->handle_request( |
|
43
|
|
|
|
|
|
|
HTTP::Engine::Test::Request->build_request_args( |
|
44
|
|
|
|
|
|
|
$request->uri, |
|
45
|
|
|
|
|
|
|
$request->content, |
|
46
|
|
|
|
|
|
|
{ |
|
47
|
|
|
|
|
|
|
headers => $request->headers, |
|
48
|
|
|
|
|
|
|
method => $request->method, |
|
49
|
|
|
|
|
|
|
protocol => $request->protocol, |
|
50
|
|
|
|
|
|
|
%args, |
|
51
|
|
|
|
|
|
|
}, |
|
52
|
|
|
|
|
|
|
), |
|
53
|
|
|
|
|
|
|
); |
|
54
|
|
|
|
|
|
|
} |
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
__INTERFACE__ |
|
57
|
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
__END__ |