Zaqar/Middleware/Auth/DynamicHeader.pm

filter: Statementstmt 100% 12 / 12 Branchbran 75.0% 3 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 2 / 2 Podpod 0.0% 0 / 1 totaltotal 89.4% 17 / 19 CC 3 SCAR 9.2
CC
3
Cov
94%
call
3.0
BEGIN
1.0
CRAP 2.5
« Zaqar.pm ↑ Summary Zaqar/Middleware/Format/JSONSometimes.pm »
1 package WebService::Zaqar::Middleware::Auth::DynamicHeader;
2  
3 # ABSTRACT: middleware for adding a dynamic authentication header value
4  
5 3 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 3 extends 'Net::HTTP::Spore::Middleware::Auth';
7  
8 3 has header_name => (isa => 'Str', is => 'ro', required => 1);
9 3 has header_value_callback => (isa => 'Code', is => 'ro', required => 1);
10  
11 5 ▶sub call {
Subroutine call: called CC=3 SCAR=11.0
Pod undocumented
12 5 my ($self, $req) = @_;
13 5 ▶ return unless $self->should_authenticate($req);
Branch: 1 branch
BranchTrueFalseTotal
unless $self->should_authenticate($req) 0 5 5
14 5 my $value = $self->header_value_callback->($req);
15 5 ▶ if (defined $value) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $value) 3 2 5
16 3 $req->header($self->header_name => $value);
17 }
18 }
19  
20 3 1;
« Zaqar.pm ↑ Summary Zaqar/Middleware/Format/JSONSometimes.pm »