package Web::ComposableRequest::Role::JSON;
use Encode qw( decode );
use JSON::MaybeXS qw( );
use Web::ComposableRequest::Constants qw( FALSE TRUE );
us
nfig _decode_body );
add_config_role __PACKAGE__.'::Config';
has '_json' => is => 'lazy', isa => Object,
builder => sub { JSON::MaybeXS->new( allow_nonref => TRUE, utf8 => FALSE )};
around '_de
body, $content)
unless $self->content_type eq 'application/json';
$body->{$self->_config->json_body_attribute} = $self->_json->decode(
decode($self->_config->encoding, $content)
);
nfig = {
prefix => 'my_app',
request_roles => [ 'L10N', 'Session', 'Cookie', 'JSON', 'Static' ], };
# Construct a request object factory
my $factory = Web::ComposableRequest
}';
my $env = { CONTENT_LENGTH => 20,
CONTENT_TYPE => 'application/json',
HTTP_COOKIE => $cookie,
HTTP_HOST => 'localhost
<Class::Inspector>
=item L<Exporter::Tiny>
=item L<HTTP::Body>
=item L<HTTP::Message>
=item L<JSON::MaybeXS>
=item L<Moo>
=item L<Subclass::Of>
=item L<Try::Tiny>
=item L<URI>
=item L<Unexpec