Condition Coverage

lib/HTTP/Promise.pm
Criterion Covered Total %
condition 0 483 0.0


and 3 conditions

line !l l&&!r l&&r condition
208 0 0 0 &Scalar::Util::blessed($_[0]) and $_[0]->isa("HTTP::Promise")
354 0 0 0 defined $file and length $file
442 0 0 0 defined $content_length and $file_length < $content_length
0 0 0 defined $content_length and $file_length > $content_length
502 0 0 0 defined $file and length $file
579 0 0 0 defined $content_length and $file_length < $content_length
0 0 0 defined $content_length and $file_length > $content_length
764 0 0 0 defined $ua and not $h->user_agent
775 0 0 0 not $h->accept_encoding and $ae ne "none"
779 0 0 0 not $ae->is_empty and $ae ne "all"
0 0 0 not $ae->is_empty and $ae ne "all" and $ae ne "auto"
802 0 0 0 not defined $h->dnt and defined $dnt
808 0 0 0 $req->uri->scheme eq "http" and !defined($upgrade_ssl) || $upgrade_ssl
901 0 0 0 $uri->scheme ne "http" and $uri->scheme ne "https"
912 0 0 0 $uri->can('port') && defined $uri->port && length $uri->port
936 0 0 0 $proxy and $no_proxy
947 0 0 0 defined $sock and &Scalar::Util::openhandle($sock)
970 0 0 0 defined $proxy_user and length $proxy_user
1069 0 0 0 $req->version and $req->version > 1
1110 0 0 0 defined $userinfo and length $userinfo
1129 0 0 0 defined $body and $body
1131 0 0 0 $body->isa("HTTP::Promise::Body::Form") and !$headers->exists('Content-Type') || $headers->content_type->is_empty
1160 0 0 0 $req->version and $req->version > 1
0 0 0 $req->version and $req->version > 1 and defined $expect_threshold
0 0 0 $req->version and $req->version > 1 and defined $expect_threshold and defined $body
0 0 0 $req->version and $req->version > 1 and defined $expect_threshold and defined $body and $body->length > $expect_threshold
1186 0 0 0 not $headers->expect and defined $body
0 0 0 not $headers->expect and defined $body and $body
1212 0 0 0 $p->{'in_keepalive'} and (length $buff // 0) == 0
0 0 0 $p->{'in_keepalive'} and (length $buff // 0) == 0 and not $opts->{'total_attempts'}
0 0 0 $p->{'in_keepalive'} and (length $buff // 0) == 0 and not $opts->{'total_attempts'} and defined $n || $code == 104 || $HTTP::Promise::IS_WIN32 && $code == 103
1239 0 0 0 $parser->error->code == 400 and length $buff > $max
1302 0 0 0 $headers->exists('Content-Encoding') && !$headers->content_encoding->is_empty
1326 0 0 0 defined $opts->{'max_redirect'} && $opts->{'max_redirect'} =~ /^\d+$/
1334 0 0 0 $max_redirect && $def->{'code'} =~ /^30[12378]$/
1339 0 0 0 defined $content_length and length $content_length
0 0 0 defined $content_length and length $content_length and not $content_length =~ /^\d+$/
1348 0 0 0 $def->{'code'} >= 100 and $def->{'code'} < 200
1375 0 0 0 defined $connection_header and lc $connection_header eq "keep-alive"
1379 0 0 0 $def->{'version'} > 1 ? $connection ne "close" : $connection eq "keep-alive" and defined $content_length || $chunked
1436 0 0 0 $ent->body and $type =~ m[^multipart/]i
1570 0 0 0 scalar @_ and defined $_[0]
0 0 0 scalar @_ and defined $_[0] and $self->_is_array($_[0]) || ref $_[0] eq 'HASH' || $self->_is_a($_[0], 'HTTP::Promise::Body::Form') || $self->_is_a($_[0], 'HTTP::Promise::Body::Form::Data')
0 0 0 scalar @_ and @_ % 2
0 0 0 scalar @_ and @_ % 2 and defined $_[-1]
0 0 0 scalar @_ and @_ % 2 and defined $_[-1] and $self->_is_array($_[-1]) || ref $_[-1] eq 'HASH' || $self->_is_a($_[-1], 'HTTP::Promise::Body::Form') || $self->_is_a($_[-1], 'HTTP::Promise::Body::Form::Data')
1604 0 0 0 ref $v and overload::Method($v, "\"\"")
1632 0 0 0 not $ct and defined $content
0 0 0 $ct and $ct eq "form-data"
1641 0 0 0 defined $ct and length "$ct"
1649 0 0 0 defined $content and length $content
1652 0 0 0 lc $type eq "application/x-www-form-urlencoded" and &Scalar::Util::reftype($content) eq 'ARRAY' || ref $content eq 'HASH' || $self->_is_a($content, 'HTTP::Promise::Body::Form')
1757 0 0 0 defined $obj and not $orig_ct
1790 0 0 0 ref $v and overload::Method($v, "\"\"")
1906 0 0 0 $total_bytes < $len and $total_bytes + $chunk_size > $len
1922 0 0 0 $total_bytes < $len and $total_bytes + $chunk_size > $len
1928 0 0 0 $total_bytes != $len and $self->_warnings_is_enabled
1984 0 0 0 $self->ext_vary and $enc = $headers->content_encoding
1993 0 0 0 $mtype and $mtype ne $default_mime
2001 0 0 0 $new_ext and $new_ext ne $ext
2021 0 0 0 $self->ext_vary and $enc = $headers->content_encoding
2087 0 0 0 $self->ext_vary and $enc = $headers->content_encoding
2166 0 0 0 $total_bytes < $len and $total_bytes + $chunk_size > $len
2177 0 0 0 defined $enc && length $enc

or 2 conditions

line l !l condition
78 0 0 $HTTP::Promise::DEFAULT_PROTOCOL || 'HTTP/1.1'
93 0 0 $ENV{'http_proxy'} || $ENV{'HTTP_PROXY'} || undef
185 0 0 'Promise::Me'->new(sub {
191 0 0 'HTTP::Promise::Request'->new('DELETE', @_) || (return $self->pass_error('HTTP::Promise::Request'->error))
193 0 0 $self->send($req) || (return $self->pass_error)
227 0 0 $self->can($meth) || (return $self->error(qq[Somehow the HTTP method "$meth" is not supported by ], ref $self))
254 0 0 'Promise::Me'->new(sub {
260 0 0 $self->_make_request_query('GET', @_) || (return $self->pass_error('HTTP::Promise::Request'->error))
262 0 0 $self->send($req) || (return $self->pass_error)
285 0 0 'Promise::Me'->new(sub {
291 0 0 $self->_make_request_query('HEAD', @_) || (return $self->pass_error('HTTP::Promise::Request'->error))
293 0 0 $self->send($req) || (return $self->pass_error)
306 0 0 shift @_ || (return $self->error('No scheme value was provided.'))
359 0 0 'HTTP::Promise::Request'->new('GET', $url) || (return &$reject('HTTP::Promise::Exception'->new({'code', 500, 'message', 'HTTP::Promise::Request'->error->message})))
369 0 0 $self->new_file($file) || (return &$reject('HTTP::Promise::Exception'->new({'code', 500, 'message', $self->error->message})))
381 0 0 $self->_datetime($mtime) || (return &$reject('HTTP::Promise::Exception'->new({'code', 500, 'message', $self->error->message})))
393 0 0 $self->send($request) || (return &$reject($self->pass_error))
414 0 0 $body->open('<') || (return &$reject('HTTP::Promise::Exception'->new({'code', 500, 'message', 'Unable to open HTTP message entity body: ' . $body->error})))
419 0 0 $tmpfile->open('>', {'autoflush', 1}) || (return &$reject('HTTP::Promise::Exception'->new({'code', 500, 'message', qq[Unable to open temporary file "$tmpfile" in write mode: ] . $tmpfile->error})))
426 0 0 $out->print($buff) or return &$reject("HTTP::Promise::Exception"->new({"code", 500, "message", qq[Unable to write to temporary file "$tmpfile": ] . $out->error}))
464 0 0 $tmpfile->move($file, 'overwrite', 1) || (return &$reject('HTTP::Promise::Exception'->new({'code', 500, 'message', "Cannot copy '${tmpfile}' to '${file}': $!"})))
507 0 0 'HTTP::Promise::Request'->new('GET', $url) || (return $self->error({'code', 500, 'message', 'HTTP::Promise::Request'->error->message}))
513 0 0 $self->new_file($file) || (return $self->pass_error)
521 0 0 $self->_datetime($mtime) || (return $self->pass_error)
530 0 0 $self->send($request) || (return $self->pass_error)
551 0 0 $body->open('<') || (return $self->error({'code', 500, 'message', 'Unable to open HTTP message entity body: ' . $body->error}))
556 0 0 $tmpfile->open('>', {'autoflush', 1}) || (return $self->error({'code', 500, 'message', qq[Unable to open temporary file "$tmpfile" in write mode: ] . $tmpfile->error}))
563 0 0 $out->print($buff) or return $self->error({"code", 500, "message", qq[Unable to write to temporary file "$tmpfile": ] . $out->error})
601 0 0 $tmpfile->move($file, 'overwrite', 1) || (return $self->error({'code', 500, 'message', "Cannot copy '${tmpfile}' to '${file}': $!"}))
642 0 0 'HTTP::Promise::Headers'->new(@_) || (return $self->pass_error('HTTP::Promise::Headers'->error))
667 0 0 'Promise::Me'->new(sub {
673 0 0 $self->_make_request_data('OPTIONS', @_) || (return $self->pass_error('HTTP::Promise::Request'->error))
675 0 0 $self->send($req) || (return $self->pass_error)
698 0 0 'Promise::Me'->new(sub {
704 0 0 $self->_make_request_data('PATCH', @_) || (return $self->pass_error('HTTP::Promise::Request'->error))
706 0 0 $self->send($req) || (return $self->pass_error)
729 0 0 'Promise::Me'->new(sub {
735 0 0 $self->_make_request_data('POST', @_) || (return $self->pass_error('HTTP::Promise::Request'->error))
737 0 0 $self->send($req) || (return $self->pass_error)
752 0 0 $self->default_protocol || 'HTTP/1.1'
836 0 0 'Promise::Me'->new(sub {
842 0 0 $self->_make_request_data('PUT', @_) || (return $self->pass_error('HTTP::Promise::Request'->error))
844 0 0 $self->send($req) || (return $self->pass_error)
855 0 0 $opts->{'read_size'} //= 0
872 0 0 'Promise::Me'->new(sub {
880 0 0 $self->send($req, $opts) || (return $self->pass_error)
894 0 0 $self->expect_threshold // 0
895 0 0 $opts->{'total_attempts'} //= 0
922 0 0 $uri->host || (return $self->error(qq[No host set for request uri "$uri".]))
949 0 0 'HTTP::Promise::IO'->new($sock, 'stop_if', $self->stop_if) || (return $self->pass_error('HTTP::Promise::IO'->error))
987 0 0 'HTTP::Promise::IO'->connect('host', $proxy->host, 'port', $proxy->port, 'stop_if', $self->stop_if, 'timeout', $timeout, 'debug', $self->debug, defined $p->{'local_host'} ? ('local_host', $p->{'local_host'}) : (), defined $p->{'local_port'} ? ('local_port', $p->{'local_port'}) : ()) || (return 'HTTP::Promise::IO'->pass_error)
1006 0 0 'HTTP::Promise::IO'->connect_ssl_over_proxy('proxy_host', $proxy->host, 'proxy_port', $proxy->port, 'host', $p->{'host'}, 'port', $p->{'port'}, 'stop_if', $self->stop_if, 'timeout', $timeout, 'proxy_authorization', $proxy_authorization, 'debug', $self->debug, defined $p->{'local_host'} ? ('local_host', $p->{'local_host'}) : (), defined $p->{'local_port'} ? ('local_port', $p->{'local_port'}) : ()) || (return 'HTTP::Promise::IO'->pass_error)
1021 0 0 'HTTP::Promise::IO'->connect('host', $uri->host, 'port', $uri->port, 'stop_if', $self->stop_if, 'timeout', $timeout, 'debug', $self->debug, defined $p->{'local_host'} ? ('local_host', $p->{'local_host'}) : (), defined $p->{'local_port'} ? ('local_port', $p->{'local_port'}) : ()) || (return 'HTTP::Promise::IO'->pass_error)
1033 0 0 'HTTP::Promise::IO'->connect_ssl('host', $uri->host, 'port', $uri->port, 'stop_if', $self->stop_if, 'timeout', $timeout, 'debug', $self->debug, defined $p->{'local_host'} ? ('local_host', $p->{'local_host'}) : (), defined $p->{'local_port'} ? ('local_port', $p->{'local_port'}) : ()) || (return 'HTTP::Promise::IO'->pass_error)
1212 0 0 length $buff // 0
1254 0 0 $def->{'headers'} || (return $self->error('No headers object set by $parser->parse_headers_xs() !'))
1312 0 0 'HTTP::Promise::Response'->new(@$def{'code', 'status', 'headers'}, {'protocol', $def->{'protocol'}, 'version', $def->{'version'}, 'debug', $self->debug}) || (return $self->pass_error('HTTP::Promise::Response'->error))
1327 0 0 $max_redirect //= 0
1337 0 0 $headers->transfer_encoding // ""
1419 0 0 $req->clone || (return $self->pass_error($req->error))
1428 0 0 $self->send($clone, $opts) || (return $self->pass_error)
1439 0 0 $ent->body->open('+<', {'binmode', 'raw'}) || (return $self->pass_error($ent->body->error))
1441 0 0 'HTTP::Promise::IO'->new($fh, 'max_read_buffer', $bufsize, 'debug', $self->debug) || (return $self->pass_error('HTTP::Promise::IO'->error))
1443 0 0 'HTTP::Promise::Entity'->new('headers', $headers, 'http_message', $resp, 'debug', $self->debug) || (return $self->pass_error('HTTP::Promise::Entity'->error))
1452 0 0 $parser->parse_multi_part('entity', $ent2, 'reader', $reader) || (return $parser->pass_error)
1473 0 0 $opts->{'read_size'} //= 0
1485 0 0 $self->send($req, $opts) || (return &$reject($self->pass_error))
1494 0 0 $self->send($req, $opts) || (return $self->pass_error)
1559 0 0 shift @_ || (return $self->error('No http method was provided.'))
1560 0 0 shift @_ || (return $self->error('No uri was provided.'))
1561 0 0 'HTTP::Promise::Request'->new($meth, $uri, {'debug', $self->debug}) || (return $self->pass_error('HTTP::Promise::Request'->error))
1565 0 0 $req->uri || (return $self->error('No URL was provided for this HTTP query.'))
1661 0 0 $content->make_parts || (return $self->pass_error($content->error))
1667 0 0 $content->as_form_data || (return $self->pass_error($content->error))
1669 0 0 $form->make_parts || (return $self->pass_error($form->error))
1683 0 0 'HTTP::Promise::Body::Form::Data'->new(@$content) || (return $self->pass_error('HTTP::Promise::Body::Form::Data'->error))
1685 0 0 $form->make_parts('fields', $fields) || (return $self->pass_error($form->error))
1693 0 0 'HTTP::Promise::Body::Form::Data'->new($content) || (return $self->pass_error('HTTP::Promise::Body::Form::Data'->error))
1695 0 0 $form->make_parts || (return $self->pass_error($form->error))
1721 0 0 'HTTP::Promise::Body::Form'->new($reftype eq 'ARRAY' ? @$content : $content) || (return $self->pass_error('HTTP::Promise::Body::Form'->error))
1733 0 0 $ent->new_body('file', $content) || (return $self->pass_error($ent->error))
1739 0 0 $ent->new_body('string', "$content") || (return $self->pass_error($ent->error))
1751 0 0 $ent->new_body('string', $content) || (return $self->pass_error($ent->error))
1778 0 0 shift @_ || (return $self->error('No http method was provided.'))
1779 0 0 shift @_ || (return $self->error('No uri was provided.'))
1780 0 0 'HTTP::Promise::Request'->new($meth, $uri, {'debug', $self->debug}) || (return $self->pass_error('HTTP::Promise::Request'->error))
1783 0 0 $req->uri || (return $self->error('No URL was provided for this HTTP query.'))
1868 0 0 $HTTP::Promise::DEFAULT_MIME_TYPE || 'application/octet-stream'
1883 0 0 $ext ||= "dat"
1884 0 0 $self->new_tempfile('extension', $ext) || (return $self->pass_error)
1895 0 0 &$get_temp_file() || (return $self->pass_error)
1896 0 0 $file->open('+>', {'binmode', 'raw', 'autoflush', 1}) || (return $self->pass_error($file->error))
1949 0 0 &$get_temp_file() || (return $self->pass_error)
1950 0 0 $file->open('+>', {'binmode', 'raw', 'autoflush', 1}) || (return $self->pass_error($file->error))
1987 0 0 'HTTP::Promise::Stream'->encoding2suffix($enc) || (return $self->pass_error('HTTP::Promise::Stream'->error))
2004 0 0 $file->extension($new_ext) || (return $self->pass_error($file->error))
2005 0 0 $file->move($new_file) || (return $self->pass_error($file->error))
2013 0 0 $file->extension($old_ext) || (return $self->pass_error($file->error))
2014 0 0 $file->move($new_file) || (return $self->pass_error($file->error))
2025 0 0 'HTTP::Promise::Stream'->encoding2suffix($enc) || (return $self->pass_error('HTTP::Promise::Stream'->error))
2030 0 0 $file->extension($old_ext) || (return $self->pass_error($file->error))
2031 0 0 $file->move($new_file) || (return $self->pass_error($file->error))
2039 0 0 $ent->new_body('file', $file) || (return $self->pass_error($ent->error))
2049 0 0 $ent->new_body('form', $data) || (return $self->pass_error($ent->error))
2054 0 0 $ent->new_body('string', $data) || (return $self->pass_error($ent->error))
2076 0 0 $HTTP::Promise::DEFAULT_MIME_TYPE || 'application/octet-stream'
2085 0 0 $ext ||= "dat"
2090 0 0 'HTTP::Promise::Stream'->encoding2suffix($enc) || (return $self->pass_error('HTTP::Promise::Stream'->error))
2094 0 0 $self->new_tempfile('extension', $ext) || (return $self->pass_error)
2098 0 0 $ent->new_body('file', $tempfile) || (return $self->pass_error($ent->error))
2100 0 0 $body->open('+>', {'binmode', 'raw', 'autoflush', 1}) || (return $self->pass_error($body->error))

or 3 conditions

line l !l&&r !l&&!r condition
318 0 0 0 $scheme eq "http" or $scheme eq "https"
790 0 0 0 $h->accept_language or $self->accept_language->is_empty
808 0 0 0 !defined($upgrade_ssl) || $upgrade_ssl
894 0 0 0 $opts->{'expect_threshold'} //= $self->expect_threshold // 0
1131 0 0 0 !$headers->exists('Content-Type') || $headers->content_type->is_empty
1147 0 0 0 $opts->{'expect_threshold'} // $self->expect_threshold
1209 0 0 0 not defined $n or $n == 0
1212 0 0 0 defined $n || $code == 104 || $HTTP::Promise::IS_WIN32 && $code == 103
1348 0 0 0 $req->method eq "HEAD" or $def->{'code'} >= 100 and $def->{'code'} < 200
0 0 0 $req->method eq "HEAD" or $def->{'code'} >= 100 and $def->{'code'} < 200 or $def->{'code'} == 204
0 0 0 $req->method eq "HEAD" or $def->{'code'} >= 100 and $def->{'code'} < 200 or $def->{'code'} == 204 or $def->{'code'} == 304
1379 0 0 0 defined $content_length || $chunked
1570 0 0 0 $self->_is_array($_[0]) || ref $_[0] eq 'HASH' || $self->_is_a($_[0], 'HTTP::Promise::Body::Form') || $self->_is_a($_[0], 'HTTP::Promise::Body::Form::Data')
0 0 0 $self->_is_array($_[-1]) || ref $_[-1] eq 'HASH' || $self->_is_a($_[-1], 'HTTP::Promise::Body::Form') || $self->_is_a($_[-1], 'HTTP::Promise::Body::Form::Data')
1604 0 0 0 ref $v eq "HASH" or $self->_is_array($v)
0 0 0 not ref $v or ref $v and overload::Method($v, "\"\"")
1652 0 0 0 &Scalar::Util::reftype($content) eq 'ARRAY' || ref $content eq 'HASH' || $self->_is_a($content, 'HTTP::Promise::Body::Form')
1788 0 0 0 lc $k eq "content" or lc $k eq "query"
1790 0 0 0 ref $v eq "HASH" or $self->_is_array($v)
0 0 0 not ref $v or ref $v and overload::Method($v, "\"\"")
1854 0 0 0 $opts->{'timeout'} // $self->timeout
1893 0 0 0 $len > $max_in_memory or $self->use_content_file
2065 0 0 0 $opts->{'timeout'} // $self->timeout