blib/lib/Ukigumo/Server/API.pm untested

filter: Statementstmt 0.0% 0 / 21 Branchbran n/a Conditioncond 0.0% 0 / 2 MC/DCmcdc n/a Subroutinesub 0.0% 0 / 6 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 30 CC 1 SCAR 6.9
CC
1
Cov
0%
dispatch
2.0
BEGIN
2.0
BEGIN
2.0
CRAP 2.0
1 package Ukigumo::Server::API;
2 use strict;
3 use warnings;
4 use parent qw/Ukigumo::Server Amon2::Web/;
5 use File::Spec;
6  
7 # dispatcher
8 use Ukigumo::Server::API::Dispatcher;
9  
10 sub dispatch {
11 my $c = shift;
12 return Ukigumo::Server::API::Dispatcher->dispatch($c) or die "response is not generated";
13 }
14  
15 __PACKAGE__->load_plugins( 'Web::JSON' );
16  
17 # for your security
18 __PACKAGE__->add_trigger(
19 AFTER_DISPATCH => sub {
20 my ( $c, $res ) = @_;
21 $res->header( 'X-Content-Type-Options' => 'nosniff' );
22 },
23 );
24  
25 1;