line |
true |
false |
branch |
55
|
2 |
8 |
if $self->{'loaded_plugins'}{$name} |
77
|
7 |
2 |
if $desc |
84
|
116 |
4 |
unless $self->{'hooks'}{$name} |
102
|
0 |
2 |
if $self->{'_loaded_middleware'}{$class}++ |
157
|
17 |
13 |
if ($self->can('swagger_build_spec')) |
167
|
0 |
30 |
if (not $route and $self->{'allowed_methods'}{$req->path}) { } |
|
0 |
30 |
elsif (not $route) { } |
178
|
0 |
30 |
if (not $code or $code and ref $code ne 'CODE') |
190
|
0 |
30 |
unless ($req->prepare_params($route->params, $route->named)) |
200
|
30 |
0 |
if (defined $data) |
202
|
0 |
30 |
if ref $data eq 'CODE' |
210
|
0 |
30 |
unless (my $ret = eval {
do {
$self->hook('before')->($self);
my $route = $self->routes->find($req->method, $req->path);
if (not $route and $self->{'allowed_methods'}{$req->path}) {
$res->status(405);
return $res->finalize;
}
elsif (not $route) {
$res->status(404);
return $res->finalize;
};
my $code = $route->code;
if (not $code or $code and ref $code ne 'CODE') {
$self->log('error', "route ${\$req->path;} returns nothing or not CODE");
$res->status(500);
$res->body('Internal error');
return $res->finalize;
};
$self->hook('before_validation')->($self);
unless ($req->prepare_params($route->params, $route->named)) {
$res->status(400);
$res->body('Invalid Parameters');
return $res->finalize;
};
$self->hook('after_validation')->($self);
my $data = &$code($req->declared_params);
if (defined $data) {
return $data if ref $data eq 'CODE';
$res->body($data);
};
$self->hook('after')->($self);
1
}
}) |
215
|
0 |
0 |
$ENV{'PLACK_ENV'} && $ENV{'PLACK_ENV'} eq 'deployment' ? : |
221
|
0 |
30 |
if (ref $ret eq 'CODE') |
232
|
30 |
0 |
unless $self->res->status |
235
|
0 |
30 |
if ($self->api_version) |
250
|
3 |
9 |
if ($format) |
254
|
6 |
6 |
unless $self->{'default_format'} |
260
|
2 |
10 |
if ($format) |
263
|
2 |
0 |
if (grep {lc $format eq $_;} @decoders) { } |
277
|
3 |
35 |
if $version |
284
|
31 |
5 |
if $req |
290
|
32 |
135 |
if $res |
297
|
0 |
0 |
unless ($self->req->env->{'psgix.session'}) |