The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

JSON::RPC::Common::Marshall::HTTP - COnvert HTTP::Request and HTTP::Response to/from JSON::RPC::Common calls and returns.

SYNOPSIS

        use JSON::RPC::Common::Marshall::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);

DESCRIPTION

This object provides marshalling routines to convert calls and returns to and from HTTP::Request and HTTP::Response objects.

ATTRIBUTES
prefer_encoded_get

When set and a params param exists, decode it as Base 64 encoded JSON and use that as the parameters instead of the query parameters.

See http://json-rpc.googlegroups.com/web/json-rpc-over-http.html.

TODO Currently buggy, no base 64 decoding is implemented. The spec is shit anyway.

content_type

Defaults to application/json.

TODO In the default the this class will choose the correct content type based on the spec in the future if one is not set explicitly.

expand

Whether or not to use an expander on GET style calls.

expander

An instance of CGI::Expand or a look alike to use for GET parameter expansion.

METHODS

request_to_call
request_to_call_post
request_to_call_get
request_to_call_get_encoded
request_to_call_get_query

Convert an HTTP::Request to a JSON::RPC::Common::Procedure::Call. Depending on what style of request it is, request_to_call will delegate to a variant.

result_to_response

Convert a JSON::RPC::Common::Procedure::Return to an HTTP::Response.

response_to_result
response_to_result_success
response_to_result_error

Convert an HTTP::Response to a JSON::RPC::Common::Procedure::Return.

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.

TODO

Conversion of JSON::RPC::Common::Procedure::Call to HTTP::Request is not yet implemented.

This should be fairly trivial but I'm a lazy bastard.

2 POD Errors

The following errors were encountered while parsing the POD:

Around line 225:

'=item' outside of any '=over'

Around line 257:

You forgot a '=back' before '=head1'