Branch Coverage

blib/lib/Mojolicious/Plugin/StrictCORS.pm
Criterion Covered Total %
branch 0 60 0.0


line true false branch
26 0 0 if exists $params{$name}
27 0 0 unless exists $route->to->{"cors_$name"}
43 0 0 if $h->header('Origin') =~ qr/\S/msu and $h->header('Access-Control-Request-Method') =~ qr/\S/msu
56 0 0 unless defined $origin
58 0 0 if not ref $_
0 0 if grep {$_ eq '*' if not ref $_;} @allow
61 0 0 if (not ref $_) { }
0 0 elsif (ref $_ eq 'Regexp') { }
0 0 if grep {if (not ref $_) { lc $origin eq lc $_; } elsif (ref $_ eq 'Regexp') { $origin =~ /$_/u; } else { die "Router 'cors_origin' param must be scalar or Regexp\n"; } ;} @allow
78 0 0 unless defined $method
83 0 0 if (not ref $_) { }
0 0 if grep {if (not ref $_) { uc $method eq uc $_; } else { die "Router 'cors_methods' param must be scalar\n"; } ;} @allow
113 0 0 unless @headers
116 0 0 if (not ref $_) { }
0 0 unless grep {if (not ref $_) { not $safe_headers{lc $_}; } else { die "Router 'cors_headers' param must be scalar\n"; } ;} @allow
129 0 0 unless $last
132 0 0 if $c->req->method eq 'OPTIONS'
138 0 0 unless @params_origin
144 0 0 unless defined $origin
149 0 0 if $params->{'credentials'} //= 0
152 0 0 if (@params_expose)
170 0 0 unless &$check_preflight($c)
176 0 0 unless @params_origin
183 0 0 unless defined $origin
189 0 0 if grep {uc $_ eq 'GET';} @params_methods and not grep({uc $_ eq 'HEAD';} @params_methods)
190 0 0 unless @params_methods
194 0 0 unless defined $methods
200 0 0 unless defined $headers
206 0 0 if $headers
210 0 0 if $params->{'credentials'} //= 0