Branch Coverage

blib/lib/Web/Machine/FSM/States.pm
Criterion Covered Total %
branch 188 202 93.0


line true false branch
51 0 0 ref $_[0] ? :
57 0 26 if ($value =~ /^"(.*)"$/)
65 0 7 if $value =~ /^"(.*)"$/
75 2 10 unless $acceptable
81 7 36 if (my $etag = $resource->generate_etag)
84 0 43 if (my $expires = $resource->expires)
87 7 36 if (my $modified = $resource->last_modified)
112 3 7 if $response->status
126 121 1 $resource->service_available ? :
133 120 1 grep({$method eq $_;} @{$resource->known_methods;}) ? :
139 1 119 $resource->uri_too_long($request->uri) ? :
146 118 1 if grep {$method eq $_;} @{$resource->allowed_methods;}
154 1 117 $resource->malformed_request ? :
162 1 116 if (is_status_code($result)) { }
113 3 elsif (defined $result and "$result" eq '1') { }
174 1 2 if ($result)
184 2 111 $resource->forbidden ? :
202 34 121 if lc($name) =~ /^content-/
205 110 1 $resource->valid_content_headers($content_headers) ? :
211 109 1 $resource->known_content_type($request->content_type) ? :
217 108 1 $resource->valid_entity_length($request->content_length) ? :
223 1 107 if ($request->method eq 'OPTIONS')
234 95 12 unless ($request->header('Accept'))
250 11 1 if (my $chosen_type = choose_media_type(\@types, $request->header('Accept')))
261 89 17 !$request->header('Accept-Language') ? :
270 15 2 if (my $language = choose_language($resource->languages_provided, $request->header('Accept-Language')))
273 14 1 if "$language" ne '1'
283 82 22 !$request->header('Accept-Charset') ? :
291 20 2 if (my $charset = choose_charset($resource->charsets_provided, $request->header('Accept-Charset')))
293 20 0 if "$charset" ne '1'
308 4 98 if ($resource->default_charset and not $request->header('Accept-Charset'))
310 2 2 ref $default ? :
313 24 78 if (my $charset = $$metadata{'Charset'})
320 13 89 if ($request->header('Accept-Encoding')) { }
324 85 4 if (my $encoding = choose_encoding($resource->encodings_provided, 'identity;q=1.0,*;q=0.5')) { }
325 19 66 unless $encoding eq 'identity'
340 9 4 if (my $encoding = choose_encoding($resource->encodings_provided, $request->header('Accept-Encoding')))
341 8 1 unless $encoding eq 'identity'
359 1 93 if scalar @{$resource->content_types_provided;} > 1
360 12 82 if scalar keys %{$resource->encodings_provided;} > 1
361 17 77 if defined $resource->charsets_provided and scalar @{$resource->charsets_provided;} > 1
362 2 92 if scalar @{$resource->languages_provided;} > 1
364 19 75 if @variances
366 58 36 $resource->resource_exists ? :
372 3 55 $request->header('If-Match') ? :
378 1 2 _unquote_header($request->header('If-Match')) eq '*' ? :
386 1 1 grep({$etag eq $_;} @etags) ? :
392 6 30 $request->header('If-Match') && _unquote_header($request->header('If-Match')) eq '*' ? :
398 6 51 $request->header('If-Unmodified-Since') ? :
405 6 0 if (my $date = $request->header('If-Unmodified-Since'))
416 3 3 defined $resource->last_modified && $resource->last_modified->epoch > $$metadata{'If-Unmodified-Since'}->epoch ? :
425 2 6 if (my $uri = $resource->moved_permanently)
426 1 1 if (is_status_code($uri))
438 8 22 $request->method eq 'PUT' ? :
444 19 35 $request->header('If-None-Match') ? :
450 6 13 $request->header('If-None-Match') eq '*' ? :
456 6 3 $request->method eq 'GET' || $request->method eq 'HEAD' ? :
464 2 18 if (my $uri = $resource->moved_permanently)
465 1 1 if (is_status_code($uri))
477 20 2 $resource->previously_existed ? :
485 3 10 $etag && grep({$etag eq $_;} @etags) ? :
491 2 16 if (my $uri = $resource->moved_temporarily)
492 1 1 if (is_status_code($uri))
504 1 1 $request->method eq 'POST' ? :
510 9 36 $request->header('If-Modified-Since') ? :
517 9 0 if (my $date = $request->header('If-Modified-Since'))
528 8 1 $$metadata{'If-Modified-Since'}->epoch > scalar time ? :
535 0 1 defined $resource->last_modified && $resource->last_modified->epoch > $$metadata{'If-Modified-Since'}->epoch ? :
544 15 1 $request->method eq 'POST' ? :
550 0 1 $resource->allow_missing_post ? :
556 4 40 $request->method eq 'DELETE' ? :
562 3 1 $resource->delete_resource ? :
568 2 1 $resource->delete_completed ? :
574 14 1 $resource->allow_missing_post ? :
581 1 5 unless $uri
585 0 5 if $uri =~ m[^/]
586 4 1 unless $uri =~ m[^/] or $base_uri =~ m[/$]
601 6 9 if ($resource->post_is_create) { }
607 6 0 unless $resource->create_path_after_handler
611 1 4 if is_status_code($handler)
614 1 3 if is_status_code($result)
616 0 3 if $resource->create_path_after_handler
621 8 1 if ($result) { }
622 1 7 if is_status_code($result)
630 3 7 if (_is_redirect($response))
631 2 1 if ($response->location) { }
645 1 39 $request->method eq 'POST' ? :
651 1 2 if $resource->is_conflict
654 0 2 if is_status_code($handler)
658 1 1 if is_status_code($result)
665 3 36 $request->method eq 'PUT' ? :
672 36 4 if ($request->method eq 'GET' or $request->method eq 'HEAD') { }
684 1 35 if is_status_code($result)
686 34 1 unless ($request->method eq 'HEAD')
687 5 29 if (ref $result eq 'CODE') { }
706 1 38 $resource->multiple_choices ? :
712 4 3 $response->body ? :
718 1 5 if $resource->is_conflict
721 1 4 if is_status_code($handler)
725 1 3 if is_status_code($result)
732 5 6 !$response->header('Location') ? :