Branch Coverage

blib/lib/Stash/REST.pm
Criterion Covered Total %
branch 87 128 67.9


line true false branch
64 1 19 if @params < 1
67 1 18 if ref $uri ne '' and ref $uri ne 'ARRAY'
69 1 17 if ref $uri eq 'ARRAY'
72 12 6 if (scalar @params % 2 == 0) { }
74 6 6 exists $conf{'data'} ? :
81 0 18 if exists $conf{'headers'} and ref $conf{'headers'} eq 'HASH'
84 0 1 if exists $conf{'files'} and (exists $conf{'headers'} and grep {/Content-Type/i;} @{$conf{'headers'};})
88 1 17 if (not $can_have_body and $data and exists $conf{'params'}) { }
3 14 elsif (not $can_have_body and $data and not exists $conf{'params'}) { }
0 14 elsif (not $can_have_body and $data) { }
90 1 0 unless $conf{'allow_get_with_body'}
98 0 0 unless $conf{'allow_get_with_body'}
114 0 1 exists $conf{'is_fail'} ? :
166 16 1 exists $conf{'data'} ? :
168 17 0 unless exists $conf{'automatic_load_item'}
173 0 4 $is_fail ? :
177 6 11 if ($conf{'params'})
178 6 0 ref $conf{'params'} eq 'ARRAY' ? :
185 14 3 exists $conf{'stash'} ? :
187 15 2 unless $conf{'headers'}
191 16 1 if (not exists $conf{'files'}) { }
192 9 7 if (defined $data) { }
204 1 0 $data && ref $data eq 'ARRAY' ? :
208 0 17 if exists $conf{'process_request'} and ref $conf{'process_request'} eq 'CODE'
216 0 17 if $@
219 0 17 if exists $conf{'process_response'} and ref $conf{'process_response'} eq 'CODE'
224 17 0 unless (exists $conf{'skip_response_tests'})
225 1 16 if $is_fail and $res->is_success
226 1 14 unless $is_fail or $res->is_success
228 1 14 if $code != $res->code
232 0 14 if exists $conf{'process_response_success'} and ref $conf{'process_response_success'} eq 'CODE'
236 1 13 if $code == 204
237 1 12 if exists $conf{'method'} and $conf{'method'} eq 'HEAD'
240 0 12 if $@
243 0 12 if exists $conf{'response_decoded'} and ref $conf{'response_decoded'} eq 'CODE'
247 11 1 if ($stashkey)
250 4 7 if exists $conf{'prepare_request'}
252 4 7 if ($code == 201)
253 4 0 if ref $obj eq 'HASH' and exists $obj->{'id'}
257 4 0 if ($item_url and $conf{'automatic_load_item'}) { }
0 0 elsif ($conf{'automatic_load_item'}) { }
263 0 3 if exists $conf{'item_loaded'} and ref $conf{'item_loaded'} eq 'CODE'
272 0 3 if exists $conf{'stash_added'} and ref $conf{'stash_added'} eq 'CODE'
277 2 8 if ($stashkey and exists $conf{'list'})
284 0 2 if exists $conf{'list_loaded'} and ref $conf{'list_loaded'} eq 'CODE'
299 1 5 exists $conf{'code'} ? :
302 6 0 unless $conf{'headers'}
305 0 6 unless $item_url
309 6 0 exists $self->stash->{$stashkey . '.prepare_request'} ? :
312 1 5 if $prepare_request and ref $prepare_request ne 'CODE'
317 5 0 if $prepare_request
324 0 5 if $code != $res->code
329 4 1 if ($res->code == 200) { }
1 0 elsif ($res->code == 404) { }
331 0 4 if $@
360 0 3 exists $conf{'code'} ? :
363 3 0 unless $conf{'headers'}
366 0 3 unless $item_url
370 3 0 exists $self->stash->{$stashkey . '.prepare_request'} ? :
372 0 3 if $prepare_request and ref $prepare_request ne 'CODE'
376 3 0 if $prepare_request
384 0 3 if $code != $res->code
389 3 0 if ($res->code == 200) { }
391 0 3 if $@