blib/lib/Mojolicious/Plugin/RequestBase.pm | |||
---|---|---|---|
Criterion | Covered | Total | % |
statement | 7 | 8 | 87.5 |
branch | 1 | 2 | 50.0 |
condition | n/a | ||
subroutine | 3 | 3 | 100.0 |
pod | 1 | 1 | 100.0 |
total | 12 | 14 | 85.7 |
line | stmt | bran | cond | sub | pod | time | code |
---|---|---|---|---|---|---|---|
1 | package Mojolicious::Plugin::RequestBase; | ||||||
2 | 1 | 1 | 972 | use Mojo::Base 'Mojolicious::Plugin'; | |||
1 | 2 | ||||||
1 | 11 | ||||||
3 | |||||||
4 | our $VERSION = '0.1'; | ||||||
5 | |||||||
6 | sub register { | ||||||
7 | 1 | 1 | 1 | 50 | my ($self, $app) = @_; | ||
8 | $app->hook(before_dispatch => sub { | ||||||
9 | 1 | 1 | 48930 | my $this=shift; | |||
10 | 1 | 50 | 6 | if(my $base=$this->req->headers->header('X-Request-Base')) { | |||
11 | 0 | $this->req->url->base(Mojo::URL->new($base)); | |||||
12 | } | ||||||
13 | 1 | 23 | }); | ||||
14 | } | ||||||
15 | |||||||
16 | 1; | ||||||
17 | __END__ |