| blib/lib/Mojolicious/Plugin/CSRF.pm | |||
|---|---|---|---|
| Criterion | Covered | Total | % |
| condition | 13 | 26 | 50.0 |
| line | !l | l&&!r | l&&r | condition |
|---|---|---|---|---|
| 28 | 0 | 0 | 3 | $format eq "html" and $$output |
| 47 | 0 | 1 | 2 | ref $conf->{'hooks'} eq "ARRAY" and @{$conf->{'hooks'};} |
| 1 | 0 | 2 | ref $conf->{'hooks'} eq "ARRAY" and @{$conf->{'hooks'};} and not @{$conf->{'hooks'};} % 2 | |
| 90 | 0 | 0 | 3 | $self->methods && ref $self->methods eq 'ARRAY' |
| 94 | 0 | 0 | 2 | $self->include and ref $self->include eq "ARRAY" |
| 105 | 0 | 0 | 2 | $self->exclude and ref $self->exclude eq "ARRAY" |
| 114 | 0 | 1 | 1 | $session && ($param && $param eq $session || $header && $header eq $session) |
| line | l | !l | condition |
|---|---|---|---|
| 44 | 0 | 1 | $conf->{'hooks'} //= ["before_routes", sub { my($c) = @_; $c->csrf->setup; $c->csrf->check; } , "after_render", sub { my($c, $output, $format) = @_; if ($format eq "html" and $$output) { my $dom = "Mojo::DOM"->new(Mojo::Util::decode("UTF-8", $$output)); my $forms = $dom->find("form[method=\"post\"]"); if ($forms->size) { $forms->each(sub { $_->append_content('csrf->token . '">'); } ); $$output = Mojo::Util::encode("UTF-8", $dom->to_string); }; }; } ] |
| line | l | !l&&r | !l&&!r | condition |
|---|---|---|---|---|
| 128 | 6 | 1 | 0 | $self->c->session($self->token_name) || $self->c->session($self->token_name, $self->generate_token->())->session($self->token_name) |