Branch Coverage

blib/lib/Plack/Middleware/CrossOrigin.pm
Criterion Covered Total %
branch 42 42 100.0


line true false branch
89 5 3 unless ref $self->origins
92 6 2 unless ref $self->methods
95 6 2 unless ref $self->headers
98 7 1 unless ref $self->expose_headers
121 17 7 if ($origin) { }
3 4 elsif ($env->{'REQUEST_METHOD'} eq 'GET' and $env->{'HTTP_USER_AGENT'} and $env->{'HTTP_USER_AGENT'} =~ m[\bAppleWebKit/(\d+\.\d+)] and $1 < 534.19 and $env->{'HTTP_REFERER'} and $env->{'HTTP_REFERER'} =~ m[\A ( \w+://[^/]+ )]msx) { }
146 3 17 $request_headers ? :
149 4 16 $continue_on_failure && !$preflight ? :
161 6 14 unless ($allowed_origins_h->{'*'} or $origin =~ /$self->{'origins_re'}/)
165 7 7 if ($preflight)
166 3 4 if ($allowed_methods_h->{'*'}) { }
1 3 elsif (not $allowed_methods_h->{$request_method}) { }
172 2 4 if ($allowed_headers_h->{'*'}) { }
1 3 elsif (grep {not defined $_;} @{$allowed_headers_h;}{map lc($_), @request_headers}) { }
179 1 11 if ($self->credentials) { }
4 7 elsif ($allowed_origins_h->{'*'}) { }
188 5 7 if ($preflight) { }
189 3 2 if (defined $self->max_age)
204 11 1 unless (_vary_headers($res->[1])->{'origin'})
208 3 9 if ($expose_headers_h->{'*'})
233 6 4 if (not _vary_headers($res->[1])->{'origin'})