Branch Coverage

blib/lib/Dancer/Plugin/CORS.pm
Criterion Covered Total %
branch 58 66 87.8


line true false branch
63 0 30 unless (defined $current_route)
67 22 8 unless (_handle($current_route))
70 16 2 if ($current_route->match($request))
83 22 8 if (blessed $route and $route->isa('Dancer::Route'))
95 25 5 unless (exists $$routes{$route})
97 8 17 unless (ref $route)
110 0 52 unless (exists $$routes{$path} or exists $$routes{$route})
120 4 48 unless (defined $origin)
125 0 48 unless (_isuri $origin)
130 28 20 $preflight ? :
134 0 48 unless (defined $requested_method)
143 37 11 if (exists $$routes{$route}) { }
159 46 3 if (exists $$options{'origin'}) { }
162 3 2 if (not $$options{'origin'}('URI'->new($origin)))
168 1 1 unless (_isin $origin, @{$$options{'origin'};})
174 1 1 unless ($origin =~ /$$options{'origin'}/u)
180 5 32 unless ($$options{'origin'} eq $origin)
193 36 3 if $origin ne '*'
195 3 36 if (exists $$options{'timing'})
196 2 1 if (defined $$options{'timing'} and $$options{'timing'} eq '1') { }
203 2 37 if (exists $$options{'credentials'})
204 2 0 unless (not $$options{'credentials'})
205 1 1 if ($origin eq '*')
213 2 36 if (exists $$options{'expose'})
217 10 28 if (exists $$options{'methods'}) { }
28 0 elsif (exists $$options{'method'}) { }
218 7 3 unless (_isin lc $requested_method, map(lc($_), @{$$options{'methods'};}))
224 10 18 unless ($$options{'method'} eq $requested_method)
231 2 19 if (exists $$options{'headers'}) { }
0 19 elsif (@requested_headers) { }
233 0 2 unless (_isin lc $requested_header, map(lc($_), @{$$options{'headers'};}))
243 2 19 if ($preflight and exists $$options{'maxage'})
257 21 27 if ($ok) { }