Group
Extension

Matches 2

UserAgent-Any-JSON ( M/MA/MATHIAS/Dist-Setup/UserAgent-Any-JSON-0.05.tar.gz, MATHIAS, 2024; MetaCPAN )
UserAgent-Any-JSON/lib/UserAgent/Any/JSON.pm ( view source; MetaCPAN )
package UserAgent::Any::JSON;

use 5.036;

use Carp;
use Moo;
use UserAgent::Any::JSON::Response;
use UserAgent::Any::Wrapper 'wrap_get_like_methods', 'wrap_post_like_methods';

use namespace::clean;
= 0.05;

extends 'UserAgent::Any';

has _converter => (
  init_arg => 'json',
  is => 'ro',
  default => sub { require JSON; JSON->new },
);

# This is not specific to GET and can actually handle any 
on/json',
    'Content-Type' => 'application/json',
    @args,
    defined $body ? ($self->_converter->encode($body)) : ());
}

sub _process_response ($self, $res, @) {
  return UserAgent::Any::JSON::
UserAgent-Any-JSON ( M/MA/MATHIAS/Dist-Setup/UserAgent-Any-JSON-0.05.tar.gz, MATHIAS, 2024; MetaCPAN )
UserAgent-Any-JSON/lib/UserAgent/Any/JSON/Response.pm ( view source; MetaCPAN )
package UserAgent::Any::JSON::Response;

use 5.036;

use Carp;
use Moo;
use Scalar::Util 'blessed';

use namespace::clean;

our $VERSION = 0.03;

extends 'UserAgent::Any::Response';

has _converter =>
=> sub { require JSON; JSON->new },
);

has json => (
  is => 'ro',
  lazy => 1,
  # TODO: here we should maybe check the Content-Type header of the response
  # (for application/json) before proceedi
1 NAME

UserAgent::Any::JSON::Response – Response object for L<UserAgent::Any::JSON>

=head1 SYNOPSIS

  my $response = $json_client->get($url);
  print Dumper($response->json) if $response->success

Powered by Groonga
Maintained by Kenichi Ishigaki <ishigaki@cpan.org>. If you find anything, submit it on GitHub.