line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Plack::Test::MockHTTP; |
2
|
60
|
|
|
60
|
|
366
|
use strict; |
|
60
|
|
|
|
|
101
|
|
|
60
|
|
|
|
|
1594
|
|
3
|
60
|
|
|
60
|
|
253
|
use warnings; |
|
60
|
|
|
|
|
123
|
|
|
60
|
|
|
|
|
1447
|
|
4
|
|
|
|
|
|
|
|
5
|
60
|
|
|
60
|
|
268
|
use Carp; |
|
60
|
|
|
|
|
98
|
|
|
60
|
|
|
|
|
3459
|
|
6
|
60
|
|
|
60
|
|
1864
|
use HTTP::Request; |
|
60
|
|
|
|
|
54087
|
|
|
60
|
|
|
|
|
1763
|
|
7
|
60
|
|
|
60
|
|
23444
|
use HTTP::Response; |
|
60
|
|
|
|
|
328385
|
|
|
60
|
|
|
|
|
1894
|
|
8
|
60
|
|
|
60
|
|
25494
|
use HTTP::Message::PSGI; |
|
60
|
|
|
|
|
141
|
|
|
60
|
|
|
|
|
3145
|
|
9
|
60
|
|
|
60
|
|
391
|
use Try::Tiny; |
|
60
|
|
|
|
|
118
|
|
|
60
|
|
|
|
|
11138
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub new { |
12
|
117
|
|
|
117
|
0
|
329
|
my($class, $app) = @_; |
13
|
117
|
|
|
|
|
627
|
bless { app => $app }, $class; |
14
|
|
|
|
|
|
|
} |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub request { |
17
|
286
|
|
|
286
|
0
|
4762
|
my($self, $req) = @_; |
18
|
|
|
|
|
|
|
|
19
|
286
|
100
|
|
|
|
689
|
$req->uri->scheme('http') unless defined $req->uri->scheme; |
20
|
286
|
100
|
|
|
|
99068
|
$req->uri->host('localhost') unless defined $req->uri->host; |
21
|
286
|
|
|
|
|
20816
|
my $env = $req->to_psgi; |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
my $res = try { |
24
|
286
|
|
|
286
|
|
12229
|
HTTP::Response->from_psgi($self->{app}->($env)); |
25
|
|
|
|
|
|
|
} catch { |
26
|
23
|
|
|
23
|
|
379
|
HTTP::Response->from_psgi([ 500, [ 'Content-Type' => 'text/plain' ], [ $_ ] ]); |
27
|
286
|
|
|
|
|
1655
|
}; |
28
|
|
|
|
|
|
|
|
29
|
286
|
|
|
|
|
4581
|
$res->request($req); |
30
|
286
|
|
|
|
|
5036
|
return $res; |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
1; |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
__END__ |