Branch Coverage

blib/lib/Mojolicious/Plugin/LinkEmbedder.pm
Criterion Covered Total %
branch 27 52 51.9


line true false branch
166 7 0 unless ref $url
168 0 7 if ($url =~ /\.(?:jpg|png|gif)\b/i)
169 0 0 if $self->_new_link_object('image', $c, {'url', $url}, $cb)
171 0 7 if ($url =~ /\.(?:mpg|mpeg|mov|mp4|ogv)\b/i)
172 0 0 if $self->_new_link_object('video', $c, {'url', $url}, $cb)
174 0 7 if ($url =~ /^spotify:\w+/i)
175 0 0 if $self->_new_link_object('open.spotify', $c, {'url', $url}, $cb)
177 3 4 unless ($url and $url->host)
205 0 4 if ($etag and $etag eq ($c->req->headers->etag // ''))
208 0 4 if (my $err = $tx->error)
211 4 0 if (my $type = lc $url->host)
214 0 4 if $self->_new_link_object($type, $c, {'_tx', $tx}, $cb)
217 0 4 if $ct =~ m[^image/] and $self->_new_link_object('image', $c, {'url', $url, '_tx', $tx}, $cb)
218 0 4 if $ct =~ m[^video/] and $self->_new_link_object('video', $c, {'url', $url, '_tx', $tx}, $cb)
219 0 4 if $ct =~ m[^text/plain] and $self->_new_link_object('text', $c, {'url', $url, '_tx', $tx}, $cb)
221 4 0 if ($ct =~ m[^text/html])
222 4 0 if $self->_new_link_object('html', $c, {'_tx', $tx}, $cb)
231 4 4 unless my $class = $$self{'classes'}{$type}
234 0 4 unless eval "require $class;1"
306 1 7 if @_ == 1
311 23 0 if (my $route = $$config{'route'})
320 23 0 unless ref $route
337 3 4 if ($err) { }
0 4 elsif ($if_none_match and $if_none_match eq $link->etag) { }
346 0 4 if $link->etag
347 4 0 if not $link->etag and $$config{'max_age'}