Branch Coverage

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


line true false branch
25 0 0 if exists $opts{$name}
26 0 0 unless exists $route->to->{"cors_$name"}
42 0 0 unless defined $origin
44 0 0 if not ref $_
0 0 if grep {$_ eq '*' if not ref $_;} @allow
47 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 q[Wrong router config 'cors_origin']; } ;} @allow
62 0 0 unless defined $method
67 0 0 if (not ref $_) { }
0 0 if grep {if (not ref $_) { uc $method eq uc $_; } else { die q[Wrong router config 'cors_methods']; } ;} @allow
95 0 0 unless @headers
98 0 0 if (not ref $_) { }
0 0 unless grep {if (not ref $_) { not $safe_headers{lc $_}; } else { die q[Wrong router config 'cors_headers']; } ;} @allow
111 0 0 unless $last
114 0 0 if $c->req->method eq 'OPTIONS'
119 0 0 unless @opts_origin
125 0 0 unless defined $origin
130 0 0 if $opts{'credentials'} //= 0
133 0 0 if (@opts_expose)
152 0 0 unless defined $c->req->headers->origin
157 0 0 if @{$opts{'origin'} //= [];}
183 0 0 unless @opts_origin
190 0 0 unless defined $origin
196 0 0 if grep {uc $_ eq 'GET';} @opts_methods and not grep({uc $_ eq 'HEAD';} @opts_methods)
197 0 0 unless @opts_methods
201 0 0 unless defined $methods
207 0 0 unless defined $headers
213 0 0 if $headers
217 0 0 if $opts{'credentials'} //= 0