| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Dancer2::Core::Role::StandardResponses; |
|
2
|
|
|
|
|
|
|
# ABSTRACT: Role to provide commonly used responses |
|
3
|
|
|
|
|
|
|
$Dancer2::Core::Role::StandardResponses::VERSION = '2.0.1'; |
|
4
|
160
|
|
|
160
|
|
940166
|
use Moo::Role; |
|
|
160
|
|
|
|
|
16755
|
|
|
|
160
|
|
|
|
|
1504
|
|
|
5
|
160
|
|
|
160
|
|
97597
|
use Dancer2::Core::HTTP; |
|
|
160
|
|
|
|
|
432
|
|
|
|
160
|
|
|
|
|
29303
|
|
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
sub response { |
|
8
|
2
|
|
|
2
|
1
|
26020
|
my ( $self, $app, $code, $message ) = @_; |
|
9
|
2
|
|
|
|
|
9
|
$app->response->status($code); |
|
10
|
2
|
|
|
|
|
1597
|
$app->response->header( 'Content-Type', 'text/plain' ); |
|
11
|
2
|
|
|
|
|
2573
|
return $message; |
|
12
|
|
|
|
|
|
|
} |
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub standard_response { |
|
15
|
1
|
|
|
1
|
1
|
924
|
my ( $self, $app, $status_code ) = @_; |
|
16
|
|
|
|
|
|
|
|
|
17
|
1
|
|
|
|
|
9
|
return $self->response( |
|
18
|
|
|
|
|
|
|
$app, |
|
19
|
|
|
|
|
|
|
$status_code, |
|
20
|
|
|
|
|
|
|
Dancer2::Core::HTTP->status_message($status_code), |
|
21
|
|
|
|
|
|
|
); |
|
22
|
|
|
|
|
|
|
} |
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
1; |
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
__END__ |