| line |
true |
false |
branch |
|
39
|
34 |
62 |
if (@_ == 1 and ref $_[0] eq 'HASH') { }
|
|
|
46 |
16 |
elsif (@_ >= 1 and $self->_is_array($_[0]) || $self->_is_a($_[0], 'HTTP::Promise::Headers') || $self->_is_a($_[0], 'HTTP::Headers') || !defined($_[0])) { }
|
|
|
1 |
30 |
elsif (@_ and ref $_[0] ne 'HASH') { }
|
|
60
|
23 |
4 |
if (!ref($_[0]) || ref $_[0] && overload::Method($_[0], '""') || $self->_is_a($_[0], 'HTTP::Promise::Body') || $self->_is_a($_[0], 'HTTP::Promise::Body::Form') and @_ == 1 || @_ > 2 && @_ % 2 && ref $_[1] ne 'HASH' || @_ == 2 && ref $_[1] eq 'HASH')
|
|
84
|
45 |
50 |
if (defined $headers) { }
|
|
86
|
16 |
29 |
if ($self->_is_a($headers, 'HTTP::Promise::Headers') or $self->_is_a($headers, 'HTTP::Headers')) { }
|
|
|
29 |
0 |
elsif ($self->_is_array($headers)) { }
|
|
105
|
0 |
95 |
if (not defined $content and $headers->exists("Content"))
|
|
112
|
29 |
66 |
if (defined $content)
|
|
114
|
1 |
28 |
unless $self->_utf8_downgrade($content)
|
|
118
|
94 |
0 |
unless exists $self->{'entity'}
|
|
120
|
94 |
0 |
unless exists $self->{'protocol'}
|
|
121
|
86 |
8 |
unless exists $self->{'version'}
|
|
123
|
0 |
94 |
unless $self->SUPER::init(@_)
|
|
125
|
94 |
0 |
unless ($ent)
|
|
127
|
0 |
94 |
unless $self->_load_class("HTTP::Promise::Entity")
|
|
138
|
28 |
66 |
if (defined $content)
|
|
140
|
0 |
28 |
if ($self->_is_a($content, ['HTTP::Promise::Body', 'HTTP::Promise::Body::Form'])) { }
|
|
142
|
0 |
0 |
unless $ent->body($content)
|
|
147
|
0 |
28 |
unless defined $body
|
|
151
|
7 |
21 |
if ($headers->content_encoding->length)
|
|
164
|
5 |
0 |
if (defined $_[0])
|
|
166
|
1 |
4 |
$self->_is_scalar($_[0]) ? :
|
|
|
1 |
4 |
unless $self->_utf8_downgrade($self->_is_scalar($_[0]) ? ${$_[0];} : $_[0])
|
|
170
|
0 |
4 |
unless ($ent = $self->entity)
|
|
172
|
0 |
0 |
unless $self->_load_class("HTTP::Promise::Entity")
|
|
177
|
3 |
1 |
if ($body) { }
|
|
179
|
0 |
3 |
unless $self->_is_a($body, "HTTP::Promise::Body::Scalar")
|
|
206
|
0 |
4 |
unless ($ent)
|
|
208
|
0 |
0 |
unless $self->_load_class("HTTP::Promise::Entity")
|
|
212
|
2 |
2 |
if (not +($self->content_type || '') =~ m[^multipart/]) { }
|
|
|
0 |
2 |
elsif ($ent->parts->is_empty and ($ent->body and not $ent->body->is_empty)) { }
|
|
|
2 |
0 |
elsif ($self->content_type->index('boundary') == -1) { }
|
|
214
|
0 |
2 |
unless $ent->make_multipart("form-data")
|
|
235
|
0 |
4 |
if (defined $this and !ref($this) || $self->_is_scalar($this) && overload::Method($this, '""'))
|
|
243
|
4 |
0 |
unless ($self->_is_a($this, "HTTP::Promise::Entity"))
|
|
245
|
0 |
4 |
unless $self->_is_a($this, "HTTP::Promise::Message")
|
|
247
|
0 |
4 |
unless ($part_ent)
|
|
253
|
0 |
4 |
if defined $name
|
|
258
|
0 |
0 |
if defined $name
|
|
272
|
0 |
0 |
unless $self->_load_class("HTTP::Promise::Body::Form")
|
|
275
|
0 |
0 |
if ($type eq 'multipart/form-data') { }
|
|
|
0 |
0 |
elsif ($type eq 'application/json') { }
|
|
|
0 |
0 |
elsif ($self->can('uri') and $uri = $self->uri and $uri->query and not defined $payload && length $payload) { }
|
|
281
|
0 |
0 |
unless length $payload
|
|
290
|
0 |
0 |
if ($@)
|
|
307
|
0 |
0 |
length($payload // '') ? :
|
|
314
|
21 |
3 |
unless defined $eol
|
|
317
|
24 |
0 |
$ent ? :
|
|
326
|
89 |
26 |
if (my $own_method = $self->SUPER::can($method))
|
|
331
|
23 |
3 |
ref $self ? :
|
|
334
|
12 |
14 |
if ($headers->can($method)) { }
|
|
355
|
1 |
2 |
if $self->entity and $self->entity->body
|
|
357
|
3 |
0 |
if $self->entity
|
|
370
|
7 |
2 |
if ($ent = $self->entity and $opts->{'clone_entity'}) { }
|
|
384
|
1 |
8 |
if defined $proto and length $proto
|
|
385
|
1 |
8 |
if defined $vers and length $vers
|
|
393
|
17 |
29 |
if (@_) { }
|
|
398
|
1 |
16 |
unless defined $_
|
|
399
|
1 |
15 |
if ref $_ and not $self->_is_scalar($_)
|
|
401
|
1 |
14 |
if $self->_is_scalar($_)
|
|
402
|
1 |
14 |
$self->_is_scalar($_) ? :
|
|
|
1 |
14 |
unless $self->_utf8_downgrade($self->_is_scalar($_) ? $$_ : $_)
|
|
407
|
0 |
15 |
unless ($ent)
|
|
410
|
0 |
0 |
unless $self->_load_class("HTTP::Promise::Entity")
|
|
415
|
7 |
8 |
unless ($body)
|
|
418
|
0 |
7 |
unless defined $body
|
|
421
|
0 |
7 |
unless (defined $rv)
|
|
424
|
0 |
7 |
unless defined $rv
|
|
429
|
0 |
15 |
if ($has_ref > 1) { }
|
|
433
|
0 |
0 |
$self->_is_scalar($_) ? :
|
|
|
0 |
0 |
unless $io->print($self->_is_scalar($_) ? $$_ : $_)
|
|
438
|
1 |
14 |
@_ == 1 && $self->_is_scalar($_[0]) ? :
|
|
|
0 |
15 |
unless $io->print(@_ == 1 && $self->_is_scalar($_[0]) ? ${$_[0];} : @_)
|
|
447
|
0 |
29 |
unless $ent
|
|
449
|
1 |
28 |
unless $body
|
|
461
|
0 |
5 |
unless $ent
|
|
468
|
1 |
3 |
if (@_) { }
|
|
470
|
0 |
1 |
unless $self->_is_scalar($_[0])
|
|
484
|
0 |
2 |
unless $self->_load_class("HTTP::Promise::Stream")
|
|
495
|
1 |
5 |
if not $ce or $ce->is_empty
|
|
498
|
0 |
5 |
if $encodings->is_empty
|
|
512
|
7 |
13 |
unless $ent->is_encoded
|
|
514
|
12 |
1 |
if ($ce)
|
|
529
|
1 |
19 |
$opts->{'raise_error'} ? :
|
|
530
|
20 |
0 |
scalar keys %$opts ? :
|
|
531
|
1 |
18 |
unless defined $body
|
|
533
|
0 |
18 |
unless ($body)
|
|
539
|
0 |
0 |
$opts->{'ref'} ? :
|
|
|
0 |
18 |
if $body->is_empty
|
|
540
|
11 |
7 |
unless ($opts->{'binmode'})
|
|
545
|
8 |
3 |
if $enc
|
|
552
|
15 |
0 |
if (exists $opts->{'binmode'} and length $opts->{'binmode'} and lc substr($opts->{'binmode'}, 0, 3) eq "utf")
|
|
559
|
18 |
0 |
scalar keys %$opts ? :
|
|
560
|
0 |
18 |
unless (defined $content)
|
|
564
|
15 |
3 |
if (defined $binmode)
|
|
566
|
0 |
15 |
unless $self->_load_class("Encode")
|
|
573
|
0 |
15 |
if ($@)
|
|
580
|
2 |
16 |
if ($self->headers->content_is_xml)
|
|
584
|
2 |
0 |
if ($$content =~ /^(?<decl>[[:blank:]\h\v]*<\?xml(.*?)\?>)/is)
|
|
604
|
0 |
0 |
if ($self->headers->content_is_xml)
|
|
609
|
0 |
0 |
if ($$data =~ /^(\s*<\?xml[^\x00]*?\?>)/)
|
|
624
|
11 |
0 |
unless defined $maxlen
|
|
626
|
7 |
4 |
unless defined $no_content
|
|
627
|
4 |
7 |
if ($ent and $ent->body)
|
|
632
|
0 |
4 |
unless defined $bytes
|
|
636
|
4 |
7 |
if (length $content) { }
|
|
638
|
0 |
4 |
if ($ent->body->length > $maxlen)
|
|
657
|
1 |
3 |
if ($content eq $no_content)
|
|
669
|
4 |
7 |
if $opts->{'preheader'}
|
|
671
|
0 |
11 |
if $chopped
|
|
674
|
2 |
9 |
if $opts->{'prefix'}
|
|
676
|
2 |
9 |
unless defined wantarray
|
|
687
|
1 |
8 |
if $self->content_type =~ m[^multipart/]
|
|
688
|
1 |
7 |
if $self->content_type =~ m[^message/]
|
|
693
|
6 |
1 |
if (@enc) { }
|
|
703
|
1 |
6 |
if not $encodings or $encodings->is_empty
|
|
708
|
5 |
0 |
if ($opts->{'update_header'})
|
|
710
|
5 |
0 |
if ($source eq "argv")
|
|
712
|
2 |
3 |
if ($e) { }
|
|
732
|
117 |
291 |
if (@_)
|
|
736
|
3 |
288 |
if ($self->_is_a($self->{'entity'}, "HTTP::Promise::Entity") and not $self->{'entity'}{'http_message'})
|
|
749
|
11 |
365 |
if (@_) { }
|
|
|
0 |
365 |
elsif (not $self->{'headers'}) { }
|
|
752
|
11 |
0 |
if ($self->_is_a($v, 'HTTP::Promise::Headers')) { }
|
|
|
0 |
0 |
elsif ($self->_is_a($v, 'HTTP::Headers')) { }
|
|
|
0 |
0 |
elsif ($self->_is_array($v)) { }
|
|
783
|
0 |
2 |
unless defined $enc and length $enc
|
|
784
|
0 |
2 |
unless $self->_load_class("HTTP::Promise::Stream")
|
|
800
|
0 |
12 |
unless defined $str
|
|
802
|
0 |
12 |
if not exists $opts->{'debug'} and ref $self
|
|
804
|
1 |
11 |
unless (length "$str")
|
|
808
|
11 |
0 |
unless ref $self
|
|
809
|
0 |
11 |
unless $self->_load_class("HTTP::Promise::Parser")
|
|
815
|
8 |
3 |
unless (defined $ent)
|
|
821
|
3 |
0 |
unless ($msg)
|
|
838
|
2 |
12 |
if ($ent and $ent->parts->is_empty and $ent->body and not $ent->body->is_empty) { }
|
|
|
1 |
14 |
elsif ($ent and $ent->parts->is_empty and $ent->body and $ent->body->is_empty) { }
|
|
843
|
0 |
2 |
unless $self->_make_parts
|
|
853
|
0 |
14 |
unless ($ent)
|
|
855
|
0 |
0 |
unless $self->_load_class("HTTP::Promise::Entity")
|
|
862
|
5 |
9 |
if (@_)
|
|
864
|
2 |
6 |
$self->_is_array($_) ? :
|
|
866
|
1 |
4 |
if ($ct =~ m[^message/]) { }
|
|
|
2 |
2 |
elsif (not $ct =~ m[^multipart/]) { }
|
|
868
|
1 |
0 |
if @parts > 1
|
|
876
|
0 |
4 |
unless $self->_load_class("HTTP::Promise::Entity")
|
|
881
|
5 |
0 |
unless ($self->_is_a($_, "HTTP::Promise::Entity"))
|
|
883
|
0 |
5 |
unless $self->_is_a($_, "HTTP::Promise::Message")
|
|
885
|
0 |
5 |
unless ($ent)
|
|
905
|
14 |
26 |
if (@_)
|
|
909
|
14 |
0 |
if ($v =~ /^$HTTP::Promise::Message::HTTP_VERSION$/) { }
|
|
940
|
0 |
2 |
unless defined $type and length $type
|
|
943
|
0 |
2 |
unless $body
|
|
944
|
0 |
2 |
if ($toptype eq 'multipart') { }
|
|
|
2 |
0 |
elsif ($type eq 'message/http') { }
|
|
|
0 |
0 |
elsif ($toptype eq 'message') { }
|
|
949
|
0 |
0 |
unless $self->_load_class("HTTP::Promise::IO")
|
|
952
|
0 |
0 |
unless $self->_load_class("HTTP::Promise::Parser")
|
|
970
|
0 |
2 |
unless $self->_load_class("HTTP::Promise::IO")
|
|
977
|
0 |
2 |
unless defined $buff
|
|
978
|
0 |
2 |
unless $self->_load_class("HTTP::Promise::Parser")
|
|
981
|
0 |
2 |
if not $def and warnings::enabled()
|
|
982
|
0 |
2 |
unless defined $def
|
|
987
|
2 |
0 |
if ($def)
|
|
991
|
1 |
1 |
if ($def->{'type'} eq 'request') { }
|
|
|
1 |
0 |
elsif ($def->{'type'} eq 'response') { }
|
|
993
|
0 |
1 |
unless $self->_load_class("HTTP::Promise::Request")
|
|
998
|
0 |
1 |
unless $self->_load_class("HTTP::Promise::Response")
|
|
1028
|
0 |
0 |
unless $self->_utf8_downgrade($_[0])
|
|
1030
|
0 |
0 |
unless not $self->entity or $_[1]
|
|
1041
|
49 |
0 |
if (defined &utf8::downgrade)
|
|
1046
|
0 |
49 |
if ($@)
|
|
1050
|
3 |
46 |
unless $rv
|
|
1057
|
10 |
3 |
if $code
|
|
1078
|
0 |
3 |
scalar @args == 1 && ref $args[0] eq 'ARRAY' ? :
|
|
1079
|
3 |
0 |
defined $ref && ref $ref eq 'ARRAY' && scalar @$ref > 1 ? :
|
|
1080
|
3 |
0 |
ref $ref eq 'ARRAY' ? :
|
|
1083
|
3 |
0 |
if (ref $self) { }
|
|
1091
|
3 |
0 |
if (exists $self->{'headers'} and defined $self->{'headers'} and ref $self->{'headers'} and $self->{'headers'}->isa("HTTP::Promise::Headers"))
|
|
1099
|
3 |
0 |
if (exists $self->{'entity'} and exists $self->{'entity'}{'headers'})
|