Branch Coverage

blib/lib/Mojolicious/Plugin/LinkEmbedder.pm
Criterion Covered Total %
branch 9 52 17.3


line true false branch
15 3 0 unless ref $url
17 0 3 if ($url =~ /\.(?:jpg|png|gif)\b/i)
18 0 0 if $self->_new_link_object('image', $c, {'url', $url}, $cb)
20 0 3 if ($url =~ /\.(?:mpg|mpeg|mov|mp4|ogv)\b/i)
21 0 0 if $self->_new_link_object('video', $c, {'url', $url}, $cb)
23 0 3 if ($url =~ /^spotify:\w+/i)
24 0 0 if $self->_new_link_object('open.spotify', $c, {'url', $url}, $cb)
26 3 0 unless ($url and $url->host)
54 0 0 if ($etag and $etag eq ($c->req->headers->etag // ''))
57 0 0 if (my $err = $tx->error)
60 0 0 if (my $type = lc $url->host)
63 0 0 if $self->_new_link_object($type, $c, {'_tx', $tx}, $cb)
66 0 0 if $ct =~ m[^image/] and $self->_new_link_object('image', $c, {'url', $url, '_tx', $tx}, $cb)
67 0 0 if $ct =~ m[^video/] and $self->_new_link_object('video', $c, {'url', $url, '_tx', $tx}, $cb)
68 0 0 if $ct =~ m[^text/plain] and $self->_new_link_object('text', $c, {'url', $url, '_tx', $tx}, $cb)
70 0 0 if ($ct =~ m[^text/html])
71 0 0 if $self->_new_link_object('html', $c, {'_tx', $tx}, $cb)
80 0 0 unless my $class = $self->{'classes'}{$type}
83 0 0 unless eval "require $class;1"
135 0 3 if @_ == 1
140 23 0 if (my $route = $config->{'route'})
149 23 0 unless ref $route
166 3 0 if ($err) { }
0 0 elsif ($if_none_match and $if_none_match eq $link->etag) { }
175 0 0 if $link->etag
176 0 0 if not $link->etag and $config->{'max_age'}