Branch Coverage

blib/lib/PAGI/WebSocket.pm
Criterion Covered Total %
branch 129 140 92.1


line true false branch
17 2 154 unless $scope and ref $scope eq "HASH"
19 2 152 unless $receive and ref $receive eq "CODE"
21 2 150 unless $send and ref $send eq "CODE"
24 1 149 unless ($scope->{'type'} // "") eq "websocket"
29 0 149 if $scope->{'pagi.websocket'}
84 0 58 unless defined $str
93 0 50 unless defined $str
94 2 48 $strict ? :
105 1 31 if %opts
107 1 24 $strict ? :
6 25 $raw ? :
108 14 17 if $self->{'scope'}{$cache_key}
114 0 29 unless length $part
124 4 25 $raw ? :
125 4 25 $raw ? :
158 4 16 if (lc $pair->[0] eq $name)
168 1 2 if $self->{'scope'}{'pagi.request.headers'}
205 1 1 unless $t
212 1 1 unless $t
219 1 1 unless $t
226 1 1 if $t and $t->can("on_high_water")
233 1 1 if $t and $t->can("on_drain")
240 1 2 unless $t
242 0 2 unless defined $high
243 1 1 $t->buffered_amount < $high ? :
271 0 43 if $self->{'_close_callbacks_ran'}
281 10 5 if (builtin::blessed($r) and $r->isa("Future"))
285 1 14 if ($@)
314 3 5 if ($event eq 'message') { }
2 3 elsif ($event eq 'close') { }
2 1 elsif ($event eq 'error') { }
335 2 6 if (builtin::blessed($r) and $r->isa("Future"))
339 1 7 if ($@)
345 1 6 if (not @{$self->{'_on_error'};})
357 2 93 if exists $opts{'subprotocol'}
358 2 93 if exists $opts{'headers'}
371 3 16 if $self->is_closed
392 2 3 $self->{'scope'}{'extensions'}{'websocket.http.response'} ? :
404 1 1 defined $opts{'body'} ? :
406 1 1 unless ($self->supports_denial_response)
431 1 6 if $self->is_closed
445 1 2 if $self->is_closed
459 1 5 if $self->is_closed
475 1 5 if $self->is_closed
483 1 4 if ($@)
492 1 5 if $self->is_closed
500 1 4 if ($@)
509 1 5 if $self->is_closed
518 1 4 if ($@)
529 1 2 unless $self->is_connected
536 1 2 unless $self->is_connected
543 1 2 unless $self->is_connected
553 5 64 if $self->is_closed
558 27 71 if (not defined $event or $event->{'type'} eq "websocket.disconnect")
568 35 36 if $event->{'type'} eq "websocket.connect"
579 10 20 unless $event
582 0 20 unless $event->{'type'} eq "websocket.receive"
583 2 18 unless exists $event->{'text'}
594 2 3 unless $event
597 0 3 unless $event->{'type'} eq "websocket.receive"
598 0 3 unless exists $event->{'bytes'}
608 1 3 unless defined $text
619 0 5 unless $event->{'type'} eq "websocket.receive"
651 3 3 unless defined $text
666 1 15 if (my $err = $@)
670 8 7 unless $event
672 0 7 unless $event->{'type'} eq "websocket.receive"
680 1 4 if (builtin::blessed($r) and $r->isa("Future"))
684 3 5 if (my $err = $@)
704 2 4 if defined $timeout