line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Web::ComposableRequest::Role::JSON; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
661
|
use namespace::autoclean; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
6
|
|
4
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
68
|
use Encode qw( decode ); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
44
|
|
6
|
1
|
|
|
1
|
|
6
|
use JSON::MaybeXS qw( ); |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
19
|
|
7
|
1
|
|
|
1
|
|
6
|
use Web::ComposableRequest::Constants qw( FALSE ); |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
7
|
|
8
|
1
|
|
|
1
|
|
183
|
use Unexpected::Types qw( Object ); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
6
|
|
9
|
1
|
|
|
1
|
|
517
|
use Moo::Role; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
7
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
requires qw( content_type _config _decode_body ); |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
has '_json' => is => 'lazy', isa => Object, |
14
|
1
|
|
|
1
|
|
22
|
builder => sub { JSON::MaybeXS->new( utf8 => FALSE ) }; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
around '_decode_body' => sub { |
17
|
|
|
|
|
|
|
my ($orig, $self, $body, $content) = @_; |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
$self->content_type eq 'application/json' |
20
|
|
|
|
|
|
|
or return $orig->( $self, $body, $content ); |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
$body->{param} = $self->_json->decode |
23
|
|
|
|
|
|
|
( decode( $self->_config->encoding, $content ) ); |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
return; |
26
|
|
|
|
|
|
|
}; |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
1; |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
__END__ |