package JSON::RPC::Common::Marshal::Catalyst;
use Moose;
use Carp qw(croak);
extends qw(JSON::RPC::Common::Marshal::HTTP);
#OVERRIDE TO CATALYST REQUEST
sub post_request_to_call {
my ( $self, $req
equest body
my $body = $request->body;
my $content = do { local $/; <$body> };
$self->json_to_call( $content );
}
sub write_result_to_response {
my ( $self, $result, $response, @a
->$key(delete $args{$key});
}
}
#Copied from base class
#JSON::RPC::Common::Marshal::HTTP introduced a "die" here. The
# following keys where left over
=head1 NAME
Catalyst::Plugin::Server::JSONRPC -- Catalyst JSONRPC Server Plugin
=head1 SYNOPSIS
package MyApp;
use Catalyst qw/Server Server::JSONRPC/;
package MyApp::Controller::Exam
sub echo : JSONRPC { # available as: example.echo
my ( $self, $c, @args ) = @_;
$c->stash->{jsonrpc} = join ', ', @args;
}
sub ping : JSONRPCPath('/ping
sh->{jsonrpc} = 'Pong';
}
sub world : JSONRPCRegex(/hello/) { # available as: *hello*
my ($self, $c) = @_;
$c->stash->{jsonrpc} = 'World';
}
sub echo : JSONRPCLo