Branch Coverage

blib/lib/JSON/API.pm
Criterion Covered Total %
branch 40 54 74.0


line true false branch
34 1 192 if $self->{'debug'}
59 0 26 if ($apphdr and ref $apphdr)
63 8 18 if (defined $data)
65 1 1 wantarray ? :
2 6 unless defined $json
74 18 6 if ($res->is_success) { }
0 6 elsif ($res->code == 304) { }
80 0 0 wantarray ? :
87 0 6 if ($res->header("client-warning") =~ /internal response/i)
88 0 0 wantarray ? :
91 22 2 $res->content ? :
95 12 12 wantarray ? :
107 3 10 unless (ref $obj eq "HASH" or ref $obj eq "ARRAY")
119 10 0 unless (eval { do { $self->{'_json'} ||= _build_json(); $json = $self->{'_json'}->encode($obj); $self->_debug("JSON created: $json") } })
120 2 8 if ($@)
141 0 27 if defined $self->{'predecodehook'}
145 27 0 unless (eval { do { $json = $self->{'predecodehook'}->($json) if defined $self->{'predecodehook'}; $self->{'_json'} ||= _build_json(); $obj = $self->{'_json'}->decode($json); $self->_debug("Deserializing successful:", Dumper($obj)) } })
146 7 20 if ($@)
162 1 37 unless $base_url
179 1 36 $base_url =~ m[^https://] ? :
180 33 4 unless $server =~ /:\d+$/
182 3 1 if $ua_opts{'realm'} and $ua_opts{'user'} and $ua_opts{'pass'}
190 2 10 if ($data)
243 0 0 unless $self->{'response'}
245 0 0 unless ($name)
254 8 1 !$self->was_success ? :
260 9 2 $self->{'has_error'} ? :