Branch Coverage

blib/lib/Dancer/Plugin/CORS.pm
Criterion Covered Total %
branch 51 62 82.2


line true false branch
62 0 8 unless (defined $current_route)
66 5 3 unless (_handle($current_route))
69 0 2 if ($current_route->match($request))
82 13 5 if (blessed $route and $route->isa('Dancer::Route'))
94 16 2 unless (exists $$routes{$route})
96 5 11 unless (ref $route)
109 0 27 unless (exists $$routes{$path} or exists $$routes{$route})
119 4 23 unless (defined $origin)
124 0 23 unless (_isuri $origin)
129 6 17 $preflight ? :
133 0 23 unless (defined $requested_method)
142 15 8 if (exists $$routes{$route}) { }
158 23 1 if (exists $$options{'origin'}) { }
161 3 2 if (not $$options{'origin'}('URI'->new($origin)))
167 1 1 unless (_isin $origin, @{$$options{'origin'};})
173 1 1 unless ($origin =~ /$$options{'origin'}/u)
179 5 9 unless ($$options{'origin'} eq $origin)
192 13 1 if $origin ne '*'
194 2 12 if (exists $$options{'credentials'})
195 2 0 unless (not $$options{'credentials'})
196 1 1 if ($origin eq '*')
204 2 11 if (exists $$options{'expose'})
208 2 11 if (exists $$options{'methods'}) { }
11 0 elsif (exists $$options{'method'}) { }
209 0 2 unless (_isin lc $requested_method, map(lc($_), @{$$options{'methods'};}))
215 0 11 unless ($$options{'method'} eq $requested_method)
222 2 11 if (exists $$options{'headers'}) { }
0 11 elsif (@requested_headers) { }
224 0 2 unless (_isin lc $requested_header, map(lc($_), @{$$options{'headers'};}))
234 2 11 if ($preflight and exists $$options{'maxage'})
248 13 10 if ($ok) { }