File Coverage

blib/lib/Mojolicious/Plugin/RequestBase.pm
Criterion Covered Total %
statement 8 8 100.0
branch 2 2 100.0
condition n/a
subroutine 3 3 100.0
pod 1 1 100.0
total 14 14 100.0


line stmt bran cond sub pod time code
1             package Mojolicious::Plugin::RequestBase;
2 1     1   763 use Mojo::Base 'Mojolicious::Plugin';
  1         2  
  1         7  
3              
4             our $VERSION = '0.2';
5              
6             sub register {
7 1     1 1 39 my ($self, $app, $config) = @_;
8              
9             $app->hook(
10             before_dispatch => sub {
11 5     5   51400 my $c = shift;
12 5 100       33 if (my $base = $c->req->headers->header('X-Request-Base')) {
13 4         115 $c->req->url->base(Mojo::URL->new($base));
14             }
15             }
16 1         11 );
17             }
18              
19             1;
20             __END__