Branch Coverage

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


line true false branch
19 320 2576 ((shift())->headers->content_type // '') =~ /$BOUNDARY_RE/u ? :
23 586 466 $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 299 2536 if $self->{'state'} eq "headers"
76 135 2401 if ($self->is_chunked and $self->{'state'} ne 'headers') { }
78 30 105 if ($self->{'chunk_state'} // "") eq "finished"
85 2397 4 unless $limit
90 99 2437 if ($self->skip_body)
98 80 2357 if ($self->auto_relax and not length $len)
100 78 2 if $connection eq "close" or not $connection
104 257 2180 if ($self->is_chunked or $self->relaxed)
112 815 1365 unless &looks_like_number($len)
113 1189 991 if ((my $need = $len - ($self->{'size'} ||= 0)) > 0)
115 258 931 $need > $len ? :
119 1922 258 if $len <= $self->progress
132 7 2215 unless my $state = $self->{'state'}
133 6 2209 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 1388 58 unless $self->auto_decompress and $self->is_compressed
182 58 0 if defined $out
185 47 11 if $status == Z_STREAM_END()
188 1 57 if length($self->{'post_buffer'} // "") > $self->max_buffer_size
193 2218 1968 if defined $self->{'header_buffer'}
195 1963 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 598 2104 unless $headers->is_finished
261 2702 2770 if ($self->{'state'} ||= "headers") eq "headers"
262 2136 3336 if $self->{'state'} ne "headers" and not $self->{'body'}++