lib/Dancer2/Core/Role/StandardResponses.pm

filter: Statementstmt 100% 14 / 14 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 4 / 4 Podpod 100% 2 / 2 totaltotal 100% 20 / 20 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
response
1.0
CRAP 1.0
« lib/Dancer2/Core/Role/Handler.pm ↑ Summary lib/Dancer2/Logger/Console.pm »
1 package Dancer2::Core::Role::StandardResponses;
2 # ABSTRACT: Role to provide commonly used responses
3 165 $Dancer2::Core::Role::StandardResponses::VERSION = '2.3.0';
4 165 ▶use Moo::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 165 ▶use Dancer2::Core::HTTP;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 8 ▶sub response {
Subroutine response: called CC=1 SCAR=0.0
Pod documented
8 8 my ( $self, $app, $code, $message ) = @_;
9 8 $app->response->status($code);
10 8 $app->response->header( 'Content-Type', 'text/plain' );
11 8 return $message;
12 }
13  
14 7 ▶sub standard_response {
Subroutine standard_response: called CC=1 SCAR=0.0
Pod documented
15 7 my ( $self, $app, $status_code ) = @_;
16  
17 7 return $self->response(
18 $app,
19 $status_code,
20 Dancer2::Core::HTTP->status_message($status_code),
21 );
22 }
23  
24 165 1;
25  
26 __END__
« lib/Dancer2/Core/Role/Handler.pm ↑ Summary lib/Dancer2/Logger/Console.pm »