Any/Impl/HttpPromise.pm untested

filter: Statementstmt 0.0% 0 / 50 Branchbran 0.0% 0 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 10 Podpod 0.0% 0 / 4 totaltotal 0.0% 0 / 70 CC 4 SCAR 13.5
CC
4
Cov
0%
call
6.0
call_cb
6.0
call_p
6.0
CRAP 3.8
1 package UserAgent::Any::Impl::HttpPromise;
2  
3 use 5.036;
4  
5 use HTTP::Promise;
6 use Moo;
7 use Promise::Me;
8 use UserAgent::Any::Impl::Helper ':all';
9  
10 use namespace::clean;
11  
12 with 'UserAgent::Any::Impl';
13  
14 our $VERSION = 0.01;
15  
16 sub call {
17 my ($self, $method, $url, $params, $content) = &get_call_args;
18 my $p = $self->{ua}->$method(
19 $url,
20 %{params_to_hash(@{$params})},
21 (defined ${$content} ? (Content => ${$content}) : ())
22 )->then(sub { return $_[0] });
23 my @r = await($p);
24 return new_response(@r);
25 }
26  
27 sub call_cb {
28 my ($self, $method, $url, $params, $content) = &get_call_args;
29 return sub ($cb) {
30 $self->{ua}->$method(
31 $url,
32 %{params_to_hash(@{$params})},
33 (defined ${$content} ? (Content => ${$content}) : ())
34 )->then(sub { $cb->(new_response($_[0])) });
35 return;
36 }
37 }
38  
39 sub call_p {
40 my ($self, $method, $url, $params, $content) = &get_call_args;
41 return $self->{ua}->$method(
42 $url,
43 %{params_to_hash(@{$params})},
44 (defined ${$content} ? (Content => ${$content}) : ())
45 )->then(sub { new_response($_[0]) });
46 }
47  
48 BEGIN { generate_methods() }
49  
50 1;
51  
52 __END__