| 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__ | ||