Branch Coverage

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


line true false branch
17 2 160 unless $scope and ref $scope eq "HASH"
19 2 158 unless $receive and ref $receive eq "CODE"
21 2 156 unless $send and ref $send eq "CODE"
24 1 155 unless ($scope->{'type'} // "") eq "websocket"
29 0 155 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 3 4 $self->{'scope'}{'extensions'}{'websocket.http.response'} ? :
404 1 3 defined $opts{'body'} ? :
406 2 2 unless ($self->supports_denial_response)
435 1 6 if $self->is_closed
449 1 2 if $self->is_closed
463 1 5 if $self->is_closed
479 2 6 if $self->is_closed
490 2 4 if $@
496 1 6 if $self->is_closed
507 2 4 if $@
513 1 6 if $self->is_closed
525 2 4 if $@
533 1 2 unless $self->is_connected
540 1 2 unless $self->is_connected
547 1 2 unless $self->is_connected
557 5 64 if $self->is_closed
562 27 71 if (not defined $event or $event->{'type'} eq "websocket.disconnect")
577 35 36 if $event->{'type'} eq "websocket.connect"
588 10 20 unless $event
591 0 20 unless $event->{'type'} eq "websocket.receive"
592 2 18 unless exists $event->{'text'}
603 2 3 unless $event
606 0 3 unless $event->{'type'} eq "websocket.receive"
607 0 3 unless exists $event->{'bytes'}
617 1 3 unless defined $text
628 0 5 unless $event->{'type'} eq "websocket.receive"
660 3 3 unless defined $text
675 1 15 if (my $err = $@)
679 8 7 unless $event
681 0 7 unless $event->{'type'} eq "websocket.receive"
689 1 4 if (builtin::blessed($r) and $r->isa("Future"))
693 3 5 if (my $err = $@)
713 2 4 if defined $timeout