Branch Coverage

blib/lib/Stash/REST.pm
Criterion Covered Total %
branch 86 122 70.4


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'} ? :
82 0 8 if ref $data ne 'ARRAY' and (exists $conf{'headers'} and not grep({'Content-Type';} @{$conf{'headers'};}))
85 0 1 if exists $conf{'files'} and (exists $conf{'headers'} and grep {'Content-Type';} @{$conf{'headers'};})
89 4 14 if (not $can_have_body and $data and ref $data eq 'ARRAY') { }
0 14 elsif (not $can_have_body and $data) { }
90 1 3 if exists $conf{'params'}
112 0 1 exists $conf{'is_fail'} ? :
164 16 1 exists $conf{'data'} ? :
166 17 0 unless exists $conf{'automatic_load_item'}
171 0 4 $is_fail ? :
175 6 11 if ($conf{'params'})
176 6 0 ref $conf{'params'} eq 'ARRAY' ? :
183 14 3 exists $conf{'stash'} ? :
185 15 2 unless $conf{'headers'}
189 16 1 if (not exists $conf{'files'}) { }
190 9 7 if (defined $data) { }
202 1 0 $data && ref $data eq 'ARRAY' ? :
206 0 17 if exists $conf{'process_request'} and ref $conf{'process_request'} eq 'CODE'
214 0 17 if $@
217 0 17 if exists $conf{'process_response'} and ref $conf{'process_response'} eq 'CODE'
222 17 0 unless (exists $conf{'skip_response_tests'})
223 1 16 if $is_fail and $res->is_success
224 1 14 unless $is_fail or $res->is_success
226 1 14 if $code != $res->code
230 0 14 if exists $conf{'process_response_success'} and ref $conf{'process_response_success'} eq 'CODE'
234 1 13 if $code == 204
235 1 12 if exists $conf{'method'} and $conf{'method'} eq 'HEAD'
238 0 12 if $@
241 0 12 if exists $conf{'response_decoded'} and ref $conf{'response_decoded'} eq 'CODE'
245 11 1 if ($stashkey)
248 4 7 if exists $conf{'prepare_request'}
250 4 7 if ($code == 201)
251 4 0 if ref $obj eq 'HASH' and exists $obj->{'id'}
255 4 0 if ($item_url and $conf{'automatic_load_item'}) { }
261 0 3 if exists $conf{'item_loaded'} and ref $conf{'item_loaded'} eq 'CODE'
270 0 3 if exists $conf{'stash_added'} and ref $conf{'stash_added'} eq 'CODE'
275 2 8 if ($stashkey and exists $conf{'list'})
282 0 2 if exists $conf{'list_loaded'} and ref $conf{'list_loaded'} eq 'CODE'
297 1 5 exists $conf{'code'} ? :
300 6 0 unless $conf{'headers'}
303 0 6 unless $item_url
307 6 0 exists $self->stash->{$stashkey . '.prepare_request'} ? :
310 1 5 if $prepare_request and ref $prepare_request ne 'CODE'
315 5 0 if $prepare_request
322 0 5 if $code != $res->code
327 4 1 if ($res->code == 200) { }
1 0 elsif ($res->code == 404) { }
329 0 4 if $@
358 0 3 exists $conf{'code'} ? :
361 3 0 unless $conf{'headers'}
364 0 3 unless $item_url
368 3 0 exists $self->stash->{$stashkey . '.prepare_request'} ? :
370 0 3 if $prepare_request and ref $prepare_request ne 'CODE'
374 3 0 if $prepare_request
382 0 3 if $code != $res->code
387 3 0 if ($res->code == 200) { }
389 0 3 if $@