Branch Coverage

blib/lib/Plack/Middleware/PeriAHS/ParseRequest.pm
Criterion Covered Total %
branch 75 134 55.9


line true false branch
80 0 0 unless (defined $host)
81 0 0 $env->{'HTTP_HOST'} =~ /(.+):(.+)/ ? :
84 0 0 unless (defined $port)
86 0 0 $env->{'HTTPS'} ? :
0 0 $env->{'HTTP_HOST'} =~ /(.+):(.+)/ ? :
93 0 0 $env->{'HTTPS'} ? :
0 0 $env->{'HTTPS'} ? :
0 0 $port == ($env->{'HTTPS'} ? 443 : 80) ? :
108 0 0 unless $uri =~ m[^/] or $uri =~ s/^pl://
154 0 33 if ($acp =~ m[^text/(?:x-)?yaml$]) { }
0 33 elsif ($acp eq 'application/json') { }
0 33 elsif ($acp eq 'text/plain') { }
1 32 elsif ($ua =~ m[Wget/|curl/]) { }
0 32 elsif ($ua =~ m[Mozilla/]) { }
174 824 29 unless $k0 =~ /\AHTTP_X_RIAP_(.+?)(_J_)?\z/
180 15 14 if ($encj)
182 1 14 unless $decsuc
191 19 13 unless (exists $rreq->{'args'})
194 12 7 unless $ct
195 0 7 if $ct eq 'application/x-www-form-urlencoded'
199 2 1 unless $ct eq 'application/json' or $ct eq 'text/yaml' and $self->{'accept_yaml'}
200 4 1 if ($ct eq 'application/json') { }
1 0 elsif ($ct eq 'text/yaml') { }
203 1 3 unless $decsuc
215 0 1 unless $decsuc
224 9 19 if ($self->{'deconfuse_php_clients'} and $rcua and $rcua =~ /$self->{'php_clients_ua_re'}/)
226 1 8 if (ref $rreq->{'args'} eq 'ARRAY' and not @{$rreq->{'args'};})
233 4 25 unless not defined $rreq->{'args'} or ref $rreq->{'args'} eq 'HASH'
237 24 1 if ($mu and not exists $rreq->{'uri'})
240 3 21 if (ref $mu eq 'ARRAY') { }
243 0 3 unless $uri =~ /$mu->[0]/
249 2 19 unless $uri =~ /$mu/
255 22 0 if (defined $rreq->{'uri'})
261 22 1 if ($self->{'parse_form'})
266 0 22 if (($rreq->{'fmt'} // $env->{'periahs.default_fmt'}) eq 'json' and defined $form->{'callback'})
271 0 0 unless $form->{'callback'} =~ /\A[A-Za-z_]\w*\z/
277 3 10 if ($k =~ /(.+):j$/) { }
0 10 elsif ($k =~ /(.+):y$/) { }
281 1 2 unless $decsuc
288 0 0 unless $self->{'accept_yaml'}
290 0 0 unless $decsuc
305 4 8 if ($k =~ /\A-riap-([\w-]+)/) { }
307 0 4 unless $rk =~ /\A\w+\z/
310 3 1 unless exists $rreq->{$rk}
312 4 4 unless exists $rreq->{'args'}{$k}
317 0 0 if ($self->{'parse_reform'} and $env->{'periahs._form_cache'} and $env->{'periahs._form_cache'}{'-submit'})
320 0 0 unless $rreq->{'uri'}
323 0 0 unless $res->[0] == 200
327 0 0 unless $meta
328 0 0 unless $meta->{'args'}
338 0 0 unless $res->[0] == 200
344 1 21 if ($self->{'parse_path_info'})
346 0 1 unless $rreq->{'uri'}
349 0 1 unless $res->[0] == 200
353 0 1 unless $meta
354 0 1 unless $meta->{'args'}
360 0 1 unless $res->[0] == 200
373 22 0 unless ($rreq->{'action'})
374 2 20 if ($rreq->{'uri'} =~ m[/$]) { }
384 0 66 unless defined $rreq->{$_}
394 14 8 unless $self->{'deconfuse_php_clients'} and $rcua and $rcua =~ /$self->{'php_clients_ua_re'}/
396 0 8 unless $rargs
401 0 8 unless $res->[0] == 200
406 8 0 if ($meta->{'args'})
409 4 3 if ($argm and $argm->{'schema'})
411 1 0 if (ref $rargs->{$arg} eq 'HASH' and not keys %{$$rargs{$arg};} and $argm->{'schema'}[0] eq 'array')
417 1 1 if (ref $rargs->{$arg} eq 'ARRAY' and not @{$rargs->{$arg};} and $argm->{'schema'}[0] eq 'hash')