Subject: | JRPC::Client does not support missing/empty parameters |
Date: | Tue, 9 Jun 2015 16:00:37 +0100 |
To: | bug-JRPC [...] rt.cpan.org |
From: | Darren Foreman <darren.foreman [...] zoopla.co.uk> |
Problem summary:
JRPC::Client does not support calls where the request object has no "params" value.
Problem description:
The JSON-RPC 2.0 spec says that "params" may be ommitted. See http://www.jsonrpc.org/specification#request_object
params
A Structured value that holds the parameter values to be used during the invocation of the method. This member MAY be omitted.
However when there are no parameters, JRPC::Client's call method dies. JRPC::Client::call always expects $params to either be a reference or well-formed JSON string.
Steps to reproduce:
$ perl -MJRPC::Client -e 'my $client = JRPC::Client->new; my $request = $client->new_request(q{http://localhost/}); $request->call("some_method", undef)'
Use of uninitialized value $param in pattern match (m//) at /usr/local/share/perl5/JRPC/Client.pm line 164.
Use of uninitialized value $param in concatenation (.) or string at /usr/local/share/perl5/JRPC/Client.pm line 168.
Malformed JSON body () at /usr/local/share/perl5/JRPC/Client.pm line 168.
Distribution:
JRPC-0.61
Version of Perl:
This is perl 5, version 16, subversion 3 (v5.16.3)
Operating system:
Linux dev-dforeman.dev.uk 3.10.57-57.140.amzn1.x86_64 #1 SMP Fri Oct 10 21:39:34 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
--
Darren Foreman
Software Developer, ZPG
T - 0844 502 1000
F - 0207 620 4770
E - darren.foreman@zpg.co.uk
www.zpg.co.uk
Registered address: Zoopla Property Group Ltd, Harlequin Building, 65 Southwark Street, London SE1 0HR. Registered in England and Wales with Company No. 6074771
www.zoopla.co.uk | www.primelocation.com | www.smartnewhomes.com | www.homesoverseas.co.uk
The information in this email is confidential and is intended solely for the addressee. Access to this email by anyone else is unauthorised. If you have received this email in error please advise ZPG immediately and delete it. Any disclosure, copying or distribution of this email, or reliance placed upon it, by unauthorised recipients is prohibited and may be unlawful.