lib/Web/Solid/Auth/Agent.pm untested

filter: Statementstmt 0.0% 0 / 38 Branchbran 0.0% 0 / 14 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 9 Podpod 0.0% 0 / 7 totaltotal 0.0% 0 / 68 CC 8 SCAR 17.0
CC
8
Cov
0%
get
6.0
head
6.0
options
6.0
CRAP 5.5
1 package Web::Solid::Auth::Agent;
2  
3 use Moo;
4  
5 extends 'LWP::UserAgent';
6  
7 has auth => (
8 is => 'ro' ,
9 required => 1
10 );
11  
12 sub get {
13 my ($self, $url , %opts ) = @_;
14 my $headers = $self->auth->make_authentication_headers($url,'GET');
15 %opts = (%opts, %$headers) if $headers;
16 return $self->SUPER::get($url,%opts);
17 }
18  
19 sub head {
20 my ($self, $url , %opts ) = @_;
21 my $headers = $self->auth->make_authentication_headers($url,'HEAD');
22 %opts = (%opts, %$headers) if $headers;
23 return $self->SUPER::head($url,%opts);
24 }
25  
26 sub options {
27 require HTTP::Request::Common;
28 my ($self, $url , %opts ) = @_;
29 my $headers = $self->auth->make_authentication_headers($url,'OPTIONS');
30 %opts = (%opts, %$headers) if $headers;
31 my @parameters = ($url, %opts);
32 my @suff = $self->_process_colonic_headers(\@parameters,1);
33 return $self->request( HTTP::Request::Common::OPTIONS( @parameters ), @suff );
34 }
35  
36 sub delete {
37 my ($self, $url , %opts ) = @_;
38 my $headers = $self->auth->make_authentication_headers($url,'DELETE');
39 %opts = (%opts, %$headers) if $headers;
40 return $self->SUPER::delete($url,%opts);
41 }
42  
43 sub post {
44 my ($self, $url ,$data, %opts ) = @_;
45 my $headers = $self->auth->make_authentication_headers($url,'POST');
46 %opts = (%opts, %$headers) if $headers;
47 return $self->SUPER::post($url,%opts, Content => $data);
48 }
49  
50 sub put {
51 my ($self, $url ,$data, %opts ) = @_;
52 my $headers = $self->auth->make_authentication_headers($url,'PUT');
53 %opts = (%opts, %$headers) if $headers;
54 return $self->SUPER::put($url,%opts, Content => $data);
55 }
56  
57 sub patch {
58 my ($self, $url ,$data, %opts ) = @_;
59 my $headers = $self->auth->make_authentication_headers($url,'PATCH');
60 %opts = (%opts, %$headers) if $headers;
61 return $self->SUPER::patch($url,%opts, Content => $data);
62 }
63  
64 1;