Branch Coverage

blib/lib/Mojolicious/Plugin/SecureCORS.pm
Criterion Covered Total %
branch 36 54 66.6


line true false branch
15 1 0 unless (exists $conf->{'max_age'})
47 2 2 unless (defined $c->req->headers->origin)
53 1 3 if ($r->to->{'cors.origin'})
69 0 8 if ($c->match->endpoint->to->{'cors.origin'}) { }
72 0 0 if ($opt_methods)
74 0 0 unless ($good_methods{lc $method})
86 4 4 unless ($match->endpoint)
93 0 4 unless ($opt{'origin'})
101 4 0 if (ref $opt{'origin'} eq 'Regexp') { }
102 1 3 unless ($origin =~ /$opt{'origin'}/msu)
106 0 0 unless $_ eq "*"
0 0 if (&none(sub { $_ eq $origin unless $_ eq "*"; } , split(' ', $opt{'origin'} // "", 0)))
113 0 3 if (ref $opt{'headers'} eq 'Regexp') { }
114 0 0 if (&any(sub { not /$opt{'headers'}/msu; } , @want_headers))
119 1 2 if (&any(sub { not exists $good_headers{$_}; } , @want_headers))
126 1 1 if (defined $headers)
129 2 0 if ($opt{'credentials'})
132 2 0 if (defined $conf->{'max_age'})
143 16 8 unless ($opt{'origin'})
151 2 6 unless (defined $origin)
155 2 4 if (ref $opt{'origin'} eq 'Regexp') { }
156 1 1 unless ($origin =~ /$opt{'origin'}/msu)
160 5 1 unless $_ eq "*"
1 3 if (&none(sub { $_ eq $origin unless $_ eq "*"; } , split(' ', $opt{'origin'} // "", 0)))
166 1 3 if ($opt{'credentials'})
169 0 4 if ($opt{'expose'})
180 50 470 if (not exists $opt{$name} and exists $r->to->{"cors.$name"})