Branch Coverage

blib/lib/PONAPI/Server.pm
Criterion Covered Total %
branch 93 114 81.5


line true false branch
62 25 25 if $ponapi_params->{'__error__'}
101 0 25 $self->{'ponapi.relative_links'} eq 'full' ? :
102 0 25 $self->{'ponapi.relative_links'} eq 'full' ? :
104 18 7 $req->method eq 'GET' ? :
123 0 47 unless grep {$_ eq $method;} 'GET', 'POST', 'PATCH', 'DELETE'
128 3 44 unless defined $type and $type =~ /$qr_member_name_prefix/
131 7 37 if (defined $rel_type) { }
1 36 elsif ($relationships) { }
132 0 7 if $relationships ne 'relationships'
141 1 43 if $def_rel_type and not $rel_type =~ /$qr_member_name_prefix/
145 32 11 if (defined $id) { }
146 2 2 if $method eq 'POST' and $relationships and $def_rel_type
147 21 3 if $method eq 'GET' and not $relationships and not $def_rel_type
148 1 23 if $method eq 'GET' and not $relationships and $def_rel_type
149 2 22 if $method eq 'GET' and $relationships and $def_rel_type
150 0 1 if $method eq 'PATCH' and not $relationships and not $def_rel_type
151 1 0 if $method eq 'PATCH' and $relationships and $def_rel_type
152 2 1 if $method eq 'DELETE' and not $relationships and not $def_rel_type
153 1 2 if $method eq 'DELETE' and $relationships and $def_rel_type
156 2 9 if $method eq 'GET'
157 9 2 if $method eq 'POST'
160 2 41 unless $action
164 30 11 if defined $id
165 7 34 if $def_rel_type
177 1 49 unless $content_type
178 1 48 unless $content_type eq $mt
181 2 46 if (my $accept = $req->headers->header('Accept'))
183 2 0 $_->[1]->type eq $mt ? :
187 1 1 if @jsonapi_accept and not grep({$_->params_are_empty;} @jsonapi_accept)
205 0 18 unless grep {$p eq $_;} 'fields', 'filter', 'page', 'include', 'sort'
209 4 14 if not defined $f and grep {$p eq $_;} 'page', 'fields', 'filter'
213 0 14 if $p eq 'sort' and not $self->{'ponapi.sort_allowed'}
216 0 11 $unesacpe_values ? :
222 4 7 if $p ne 'fields' and exists $query_params->{$k} and not @values
226 3 7 if grep {$p eq $_;} 'fields', 'filter'
229 0 10 if $p eq 'page'
232 7 3 if $p eq 'include'
237 0 10 if $p eq 'sort'
246 21 12 unless $req->content_length > 0
248 0 12 if $req->method eq 'GET'
253 0 11 unless $body and ref $body eq 'HASH' and exists $body->{'data'}
257 1 10 unless not defined $data or ref($data) =~ /^(?:ARRAY|HASH)$/
259 10 0 if defined $data
267 2 8 ref $data eq 'ARRAY' ? :
270 0 10 unless keys %{$r;}
273 0 10 unless $r->{'type'}
274 1 9 unless check_name($r->{'type'})
277 3 6 if ($r->{'attributes'})
278 1 2 unless ref $r->{'attributes'} eq 'HASH'
280 1 1 if grep {not check_name($_);} keys %{$$r{'attributes'};}
284 3 4 if ($r->{'relationships'})
285 1 2 unless ref $r->{'relationships'} eq 'HASH'
288 1 1 unless check_name($k)
293 0 1 if !ref($r->{'relationships'}{$k}{$_}) eq 'HASH' or not exists $r->{'relationships'}{$k}{$_}{'type'}
297 1 0 if not check_name($r->{'relationships'}{$k}{$_}{'type'}) or grep {not check_name($_);} keys %{$$r{'relationships'}{$k}{$_};}
311 50 0 if $self->{'ponapi.send_version_header'}
312 50 0 if (ref $content)