CatalystX-RequestModel
view release on metacpan or search on metacpan
---
abstract: 'Map body and data parameters to a model'
author:
- 'John Napiorkowski <jjnapiork@cpan.org>'
build_requires:
Catalyst::Test: '0'
HTTP::Request::Common: '0'
Test::Lib: '0.003'
Test::Most: '0.34'
configure_requires:
ExtUtils::MakeMaker: '0'
dynamic_config: 0
generated_by: 'Dist::Zilla version 6.032, CPAN::Meta::Converter version 2.150010'
license: perl
meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.4.html
version: '1.4'
Makefile.PL view on Meta::CPAN
"JSON::MaybeXS" => 0,
"Module::Pluggable::Object" => 0,
"Module::Runtime" => 0,
"Moo" => "2.005004",
"Moose" => "2.1403",
"Scalar::Util" => "1.55",
"String::CamelCase" => 0
},
"TEST_REQUIRES" => {
"Catalyst::Test" => 0,
"HTTP::Request::Common" => 0,
"Test::Lib" => "0.003",
"Test::Most" => "0.34"
},
"VERSION" => "0.020",
"test" => {
"TESTS" => "t/*.t"
}
);
my %FallbackPrereqs = (
"Catalyst" => "5.90121",
"Catalyst::Test" => 0,
"CatalystX::Errors" => "0.001008",
"Class::Method::Modifiers" => 0,
"HTTP::Request::Common" => 0,
"JSON::MaybeXS" => 0,
"Module::Pluggable::Object" => 0,
"Module::Runtime" => 0,
"Moo" => "2.005004",
"Moose" => "2.1403",
"Scalar::Util" => "1.55",
"String::CamelCase" => 0,
"Test::Lib" => "0.003",
"Test::Most" => "0.34"
);
Moo = 2.005004
Module::Pluggable::Object = 0
Module::Runtime = 0
JSON::MaybeXS = 0
String::CamelCase = 0
[Prereqs / TestRequires]
Test::Most = 0.34
Test::Lib = 0.003
Catalyst::Test = 0
HTTP::Request::Common = 0
BEGIN {
use Test::Most;
eval "use Catalyst 5.90090; 1" || do {
plan skip_all => "Need a newer version of Catalyst => $@";
};
}
use Test::Lib;
use HTTP::Request::Common;
use Catalyst::Test 'Example';
ok my $body_parameters = [
username => 'jjn',
password => 'abc123',
];
{
ok my $res = request POST '/root/test1', $body_parameters;
ok my $data = eval $res->content;
BEGIN {
use Test::Most;
eval "use Catalyst 5.90090; 1" || do {
plan skip_all => "Need a newer version of Catalyst => $@";
};
}
use Test::Lib;
use HTTP::Request::Common;
use Catalyst::Test 'Example';
{
ok my $body_parameters = [
'person.first_name' => 2,
'person.first_name' => 'John', # flatten array should just pick the last one
'person.last_name' => 'Napiorkowski',
'person.username' => 'jjn',
'person.notes' => '{"test":"one", "foo":"bar"}',
'person.maybe_array' => 'one',
BEGIN {
use Test::Most;
eval "use Catalyst 5.90090; 1" || do {
plan skip_all => "Need a newer version of Catalyst => $@";
};
}
use Test::Lib;
use HTTP::Request::Common;
use Catalyst::Test 'Example';
{
ok my $data = qq[
{
"person":{
"username": "jjn",
"first_name": "john",
"last_name": "napiorkowski",
"profile": {
BEGIN {
use Test::Most;
eval "use Catalyst 5.90090; 1" || do {
plan skip_all => "Need a newer version of Catalyst => $@";
};
}
use Test::Lib;
use HTTP::Request::Common;
use Catalyst::Test 'Example';
{
ok my $res = request GET '/info?page=10;offset=100;search=nope';
ok my $data = eval $res->content;
is_deeply $data, +{
page=>10,
offset=>100,
search=>'nope'
};
BEGIN {
use Test::Most;
eval "use Catalyst 5.90090; 1" || do {
plan skip_all => "Need a newer version of Catalyst => $@";
};
}
use Test::Lib;
use HTTP::Request::Common;
use Catalyst::Test 'Example';
{
ok my $res = request GET '/info2?page=10;offset=100;search=nope';
ok my $data = eval $res->content;
is_deeply $data, +{
page=>10,
offset=>100,
search=>'nope'
BEGIN {
use Test::Most;
eval "use Catalyst 5.90090; 1" || do {
plan skip_all => "Need a newer version of Catalyst => $@";
};
}
use Test::Lib;
use HTTP::Request::Common;
use Catalyst::Test 'Example';
{
ok my $body_parameters = [
notes => 'This is the file you seek!',
file =>[ undef, 'file.txt', Content => 'the file info' ]
];
ok my $res = request POST '/upload',
Content_Type => 'form-data',
( run in 0.406 second using v1.01-cache-2.11-cpan-de7293f3b23 )