Branch Coverage

blib/lib/Mojo/UserAgent.pm
Criterion Covered Total %
branch 88 102 86.2


line true false branch
37 18 89 ref $_[-1] eq 'CODE' ? :
46 77 0 unless ${^GLOBAL_PHASE} eq "DESTRUCT"
55 3 1009 if $self->{'pid'} and $self->{'pid'} ne $$
59 159 853 if ($cb)
100 0 222 $handle ? :
103 0 222 if ($proto eq 'http+unix') { }
106 0 222 if $handle
109 1 221 if ($proto eq "socks")
113 0 1 if $userinfo
117 2 220 if ($options{'tls'} = $proto eq "https")
120 0 2 if $self->insecure
130 0 220 unless $self
131 3 217 if $err
135 188 1 if $self
136 0 0 if $self
147 225 2 unless my $new = $self->transactor->proxy_connect($old)
158 0 1 if $tx->error or not $tx->res->is_success or not $tx->keep_alive
161 1 0 unless $tx->req->url->protocol eq "https"
178 800 227 if ($id = $self->_dequeue($loop, "${proto}:${host}:$port", 1))
181 800 0 unless $tx->connection
187 2 225 if (my $id = $self->_connect_proxy($loop, $tx, $cb))
191 3 2 unless $proto eq "http" or $proto eq "https" or $proto eq "http+unix"
205 56 871 if $found or not grep({$_ eq $name;} @$queued)
208 2 869 unless my $stream = $loop->stream($queued->[1])
209 0 869 $test && $stream->is_readable ? :
219 8 1 if $tx
227 157 1157 unless my $c = $self->{'connections'}{$id}
228 21 1136 if $c->{'timeout'}
229 71 1086 unless my $old = $c->{'tx'}
233 4 35 if $close and not $res->code and not $res->error
236 62 1024 if $old->is_websocket
240 74 950 if (my $new = $self->transactor->upgrade($old))
248 948 2 unless uc $old->req->method eq "CONNECT"
249 134 816 if $res->is_error
250 937 13 unless $self->_redirect($c, $old)
260 1018 0 unless ($handle->isa("IO::Socket::UNIX"))
274 1 1180 unless my $tx = $self->{'connections'}{$id}{'tx'}
277 1047 133 if $tx->is_finished
282 916 34 unless my $new = $self->transactor->redirect($old)
283 21 13 unless @{$old->redirects;} < $self->max_redirects
290 1 196 unless $c->{'ioloop'}
302 24 888 if $close or not $tx or not $max or not $tx->keep_alive or $tx->error
316 956 71 if (not $url->is_abs and my $server = $self->server)
317 908 48 $loop == $self->ioloop ? :
323 41 986 if defined $max
327 982 45 unless $loop->is_running
328 3 1024 unless my $id = $self->_connection($loop, $tx, $cb)
330 21 1003 if (my $t = $self->request_timeout)
345 22 2618 if not my $tx = $c->{'tx'} or $c->{'writing'}
349 1318 1300 unless length $chunk
352 1249 1 if $self