Any/Response/Impl.pm

filter: Statementstmt 100% 16 / 16 Branchbran 100% 2 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 4 / 4 Podpod n/a totaltotal 100% 22 / 22 CC 2 SCAR 3.4
CC
2
Cov
100%
__ANON__
2.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.4
« Any/Response/Impl/HttpPromiseResponse.pm ↑ Summary Any/Response/Impl/HttpResponse.pm »
1 package UserAgent::Any::Response::Impl;
2  
3 11 ▶use 5.036;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 11 ▶use Moo::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 11 ▶use namespace::clean;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 11 our $VERSION = 0.01;
10  
11 11 has res => (
12 is => 'ro',
13 required => 1,
14 );
15  
16 # This is used to compensate for some response implementation that don’t decode
17 # JSON content (as it’s not in the spec).
18 has _forced_charset => (
19 is => 'ro',
20 lazy => 1,
21 2 ▶ default => sub ($self) {
Subroutine __ANON__: called CC=2 SCAR=6.9
22 2 ▶ if ($self->header('Content-Type') =~ m{^ application/json \s* ; .* \s* charset=([^ ;]+) }xi)
Branch: 1 branch
BranchTrueFalseTotal
if ($self->header('Content-Type') =~ m[^ application/json \s* ; .* \s* charset=([^ ;]+) ]iux) { } 1 1 2
23 {
24 1 return $1;
25 } else {
26 1 return;
27 }
28 },
29 11 );
30  
31 11 requires qw(status_code status_text success content raw_content headers header);
32  
33 11 1;
« Any/Response/Impl/HttpPromiseResponse.pm ↑ Summary Any/Response/Impl/HttpResponse.pm »