Plack::Middleware::ValidateJSON;
use strict;
use warnings;
use parent qw( Plack::Middleware );
use JSON::MaybeXS;
use Plack::Request;
# ABSTRACT: Checks validity of JSON POST'd to a Plack app and
esponse if the JSON is not valid
=head1 NAME
Plack::Middleware::ValidateJSON
=head1 DESCRIPTION
Check validity of JSON POST'ed to the app and generate a 422 HTTP response if the JSON is not valid
he event of invalid JSON.
=cut
sub call {
my($self, $env) = @_;
my $request = Plack::Request->new($env);
# if content is present, make certain that it is valid JSON, otherwise there is