Branch Coverage

blib/lib/Mojo/Content.pm
Criterion Covered Total %
branch 95 96 98.9


line true false branch
19 321 2605 ((shift())->headers->content_type // '') =~ /$BOUNDARY_RE/u ? :
23 594 471 $type =~ /charset\s*=\s*"?([^"\s;]+)"?/iu ? :
28 4 15 if $self->is_dynamic
35 138 49 unless length($self->{'body_buffer'} //= "")
36 122 64 if length $self->{'body_buffer'}
37 49 15 if $self->{'eof'}
40 3 12 &looks_like_number($len) && $len == $offset ? :
72 301 2564 if $self->{'state'} eq "headers"
76 135 2429 if ($self->is_chunked and $self->{'state'} ne 'headers') { }
78 30 105 if ($self->{'chunk_state'} // "") eq "finished"
85 2425 4 unless $limit
90 99 2465 if ($self->skip_body)
98 81 2384 if ($self->auto_relax and not length $len)
100 79 2 if $connection eq "close" or not $connection
104 259 2206 if ($self->is_chunked or $self->relaxed)
112 827 1379 unless &looks_like_number($len)
113 1203 1003 if ((my $need = $len - ($self->{'size'} ||= 0)) > 0)
115 260 943 $need > $len ? :
119 1946 260 if $len <= $self->progress
132 7 2241 unless my $state = $self->{'state'}
133 6 2235 unless $state eq "body" or $state eq "finished"
141 73 2 if defined $chunk
142 28 47 if $cb
143 29 46 if defined $chunk and not length $chunk
151 27 76 unless $self->{'chunked'}
154 102 1 if defined $chunk
155 60 43 if $cb
156 21 82 if defined $chunk and not length $chunk
165 21 81 unless length $chunk
168 54 27 $self->{'chunks'}++ ? :
176 1400 62 unless $self->auto_decompress and $self->is_compressed
182 62 0 if defined $out
185 51 11 if $status == Z_STREAM_END()
188 1 61 if length($self->{'post_buffer'} // "") > $self->max_buffer_size
193 2242 1992 if defined $self->{'header_buffer'}
195 1987 5 $headers ? :
203 2 133 if ($self->{'chunk_state'} // "") eq "trailing_headers"
208 151 101 unless ($self->{'chunk_len'})
209 20 131 unless $self->{'pre_buffer'} =~ s/^(?:\x0d?\x0a)?([0-9a-fA-F]+).*\x0a//u
210 101 30 if $self->{'chunk_len'} = hex $1
218 55 46 if $self->{'chunk_len'} < $len
225 30 103 if ($self->{'chunk_state'} // "") eq "trailing_headers"
228 1 132 if length($self->{'pre_buffer'} // "") > $self->max_buffer_size
235 2 30 unless $headers->is_finished
241 29 1 unless $headers->content_length
248 602 2128 unless $headers->is_finished
261 2730 2801 if ($self->{'state'} ||= "headers") eq "headers"
262 2160 3371 if $self->{'state'} ne "headers" and not $self->{'body'}++