package Test::JSON::RPC::Autodoc;
use 5.008001;
use strict;
use warnings;
use File::ShareDir;
use Path::Tiny qw/path/;
use Text::Xslate;
use Test::JSON::RPC::Autodoc::Request;
our $VERSION = "0.15";
, $class;
return $self;
}
sub new_request {
my ($self, $label) = @_;
my $req = Test::JSON::RPC::Autodoc::Request->new(
app => $self->{app},
path => $self->{path},
File::ShareDir::dist_dir('Test-JSON-RPC-Autodoc') unless -d $dir;
return Text::Xslate->new( path => $dir );
}
1;
__END__
=encoding utf-8
=head1 NAME
Test::JSON::RPC::Autodoc - Testing tools f
Test::JSON::RPC::Autodoc::Response;
use strict;
use warnings;
use HTTP::Message::PSGI;
use parent qw/HTTP::Response/;
use Data::Recursive::Encode;
use Encode qw/decode_utf8 encode_utf8/;
use JSON qw//
onse::from_json {
my $self = shift;
my $content = $self->content();
return unless $content;
return JSON::from_json(decode_utf8($content));
}
sub HTTP::Response::pretty_json {
my $
t;
my $content = $self->content();
return unless $content;
my $data = JSON::from_json(decode_utf8($content));
my $json = JSON::to_json($data, { pretty => 1 });
return $json;
}
1;
package Test::JSON::RPC::Autodoc::Validator;
use strict;
use warnings;
use parent qw/Data::Validator/;
1;
ckage Test::JSON::RPC::Autodoc::Request;
use strict;
use warnings;
use parent qw/HTTP::Request/;
use Clone qw/clone/;
use JSON qw/to_json/;
use Test::Builder;
use Try::Tiny;
use Test::JSON::RPC::Autod
oc::Response;
use Test::JSON::RPC::Autodoc::Validator;
use Plack::Test::MockHTTP;
sub new {
my ($class, %opt) = @_;
my $self = $class->SUPER::new();
$self->uri($opt{path} || '/');
$se
t{label} || undef;
return $self;
}
sub json_rpc_method {
my ($self, $name) = @_;
return $self->{json_rpc_method} unless $name;
$self->{json_rpc_method} = $name;
return $name;
}
s