Skip to content

Instantly share code, notes, and snippets.

@yusukebe
Created November 9, 2014 12:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yusukebe/1157c71b7f9b13c3c927 to your computer and use it in GitHub Desktop.
Save yusukebe/1157c71b7f9b13c3c927 to your computer and use it in GitHub Desktop.
just poc
use strict;
use warnings;
use MyApp;
use Test::JSON::RPC::Autodoc;
my $psgi = MyApp->new();
my $test = Test::JSON::RPC::Autodoc->new({
document_root => '/docs',
app => $psgi->to_app()
});
my $rpc_req = $test->new_request();
$rpc_req->params(
name => { type => 'Str', required => 1, documentation => 'Name of you.' },
age => { type => 'Int', documentation => 'Age of you.' }
);
$rpc_req->post_ok( '/', 'some_method', { name => 'yusuke', age => 32 } );
my $res = $rpc_req->response();
my $data = $res->from_json();
is $data->{result}{your_name}, 'yusuke';
$rpc_req->write('sample.md');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment