Branch Coverage

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


line true false branch
19 349 2600 ((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 318 2570 if $self->{'state'} eq "headers"
76 139 2431 if ($self->is_chunked and $self->{'state'} ne 'headers') { }
78 30 109 if ($self->{'chunk_state'} // "") eq "finished"
85 2427 4 unless $limit
90 99 2471 if ($self->skip_body)
98 84 2387 if ($self->auto_relax and not length $len)
100 82 2 if $connection eq "close" or not $connection
104 262 2209 if ($self->is_chunked or $self->relaxed)
112 815 1394 unless &looks_like_number($len)
113 1218 991 if ((my $need = $len - ($self->{'size'} ||= 0)) > 0)
115 287 931 $need > $len ? :
119 1922 287 if $len <= $self->progress
132 7 2244 unless my $state = $self->{'state'}
133 6 2238 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 1422 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 137 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 51 50 if $self->{'chunk_len'} < $len
225 30 107 if ($self->{'chunk_state'} // "") eq "trailing_headers"
228 1 136 if length($self->{'pre_buffer'} // "") > $self->max_buffer_size
235 2 30 unless $headers->is_finished
241 29 1 unless $headers->content_length
248 636 2104 unless $headers->is_finished
261 2740 2809 if ($self->{'state'} ||= "headers") eq "headers"
262 2136 3413 if $self->{'state'} ne "headers" and not $self->{'body'}++