line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Plack::Test::MockHTTP; |
2
|
60
|
|
|
60
|
|
357
|
use strict; |
|
60
|
|
|
|
|
102
|
|
|
60
|
|
|
|
|
1588
|
|
3
|
60
|
|
|
60
|
|
267
|
use warnings; |
|
60
|
|
|
|
|
101
|
|
|
60
|
|
|
|
|
1375
|
|
4
|
|
|
|
|
|
|
|
5
|
60
|
|
|
60
|
|
271
|
use Carp; |
|
60
|
|
|
|
|
104
|
|
|
60
|
|
|
|
|
3329
|
|
6
|
60
|
|
|
60
|
|
1860
|
use HTTP::Request; |
|
60
|
|
|
|
|
53725
|
|
|
60
|
|
|
|
|
1697
|
|
7
|
60
|
|
|
60
|
|
23011
|
use HTTP::Response; |
|
60
|
|
|
|
|
326574
|
|
|
60
|
|
|
|
|
1802
|
|
8
|
60
|
|
|
60
|
|
25192
|
use HTTP::Message::PSGI; |
|
60
|
|
|
|
|
148
|
|
|
60
|
|
|
|
|
3089
|
|
9
|
60
|
|
|
60
|
|
388
|
use Try::Tiny; |
|
60
|
|
|
|
|
109
|
|
|
60
|
|
|
|
|
11072
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub new { |
12
|
117
|
|
|
117
|
0
|
309
|
my($class, $app) = @_; |
13
|
117
|
|
|
|
|
612
|
bless { app => $app }, $class; |
14
|
|
|
|
|
|
|
} |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub request { |
17
|
285
|
|
|
285
|
0
|
4380
|
my($self, $req) = @_; |
18
|
|
|
|
|
|
|
|
19
|
285
|
100
|
|
|
|
740
|
$req->uri->scheme('http') unless defined $req->uri->scheme; |
20
|
285
|
100
|
|
|
|
98650
|
$req->uri->host('localhost') unless defined $req->uri->host; |
21
|
285
|
|
|
|
|
20818
|
my $env = $req->to_psgi; |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
my $res = try { |
24
|
285
|
|
|
285
|
|
12069
|
HTTP::Response->from_psgi($self->{app}->($env)); |
25
|
|
|
|
|
|
|
} catch { |
26
|
23
|
|
|
23
|
|
368
|
HTTP::Response->from_psgi([ 500, [ 'Content-Type' => 'text/plain' ], [ $_ ] ]); |
27
|
285
|
|
|
|
|
1692
|
}; |
28
|
|
|
|
|
|
|
|
29
|
285
|
|
|
|
|
4717
|
$res->request($req); |
30
|
285
|
|
|
|
|
5045
|
return $res; |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
1; |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
__END__ |