JSON::RPC::Common::Marshal::HTTP(3pm) | User Contributed Perl Documentation | JSON::RPC::Common::Marshal::HTTP(3pm) |
JSON::RPC::Common::Marshal::HTTP - Convert HTTP::Request and HTTP::Response to/from JSON::RPC::Common calls and returns.
version 0.11
use JSON::RPC::Common::Marshal::HTTP; my $m = JSON::RPC::Common::Marshal::HTTP->new; my $call = $m->request_to_call($http_request); my $res = $call->call($object); my $http_response = $m->result_to_response($res);
This object provides marshalling routines to convert calls and returns to and from HTTP::Request and HTTP::Response objects.
Not reccomended.
See <http://json-rpc.googlegroups.com/web/json-rpc-over-http.html>.
Otherwise they will default to "application/json" with calls/returns version 1.0 and 1.1, and "application/json-rpc" with 2.0 objects.
Get requests call "uri_to_call"
A variant is chosen based on "HTTP::Response/is_success".
The error handler will ensure that "error" in JSON::RPC::Common::Procedure::Return is set.
The arguments can contain a "uri" parameter, which is the base of the request.
With GET requests, under "rest_style_methods" that URI's path will be appended, and otherwise parameters will just be added.
POST requests do not cloen and alter the URI.
If no URI is provided as an argument, "/" will be used.
The flags "prefer_get" and "encoded" can also be passed to "call_to_request" to alter the type of request to be generated.
Subclass and override to process query params into RPC params as necessary.
Note that this is NOT in any of the JSON-RPC specs.
Yuval Kogman <nothingmuch@woobling.org>
This software is copyright (c) 2014 by Yuval Kogman and others.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
2020-06-23 | perl v5.30.3 |