Amon2-Lite
view release on metacpan or search on metacpan
lib/Amon2/Lite.pm view on Meta::CPAN
125126127128129130131132133134135136137138139140141142143144145*{
"$caller\::post"
} =
sub
{
$router
->
connect
(
$_
[0], {
code
=>
$_
[1],
method
=> [
'POST'
]}, {
method
=> [
'POST'
]});
};
*{
"${base_class}\::dispatch"
} =
sub
{
my
(
$c
) =
@_
;
if
(
my
$p
=
$router
->match(
$c
->request->env)) {
return
$p
->{code}->(
$c
,
$p
);
}
else
{
if
(
$router
->method_not_allowed) {
my
$content
=
'405 Method Not Allowed'
;
return
$c
->create_response(
405,
[
'Content-Type'
=>
'text/plain; charset=utf-8'
,
'Content-Length'
=>
length
(
$content
),
],
[
$content
]
);
}
else
{
t/400_lite/09_get_post.t view on Meta::CPAN
35363738394041424344454647484950
is(
$res
->content,
'post'
);
};
subtest
'GET /get_only'
=>
sub
{
is(
$res
->code, 200);
};
subtest
'POST /get_only'
=>
sub
{
is(
$res
->code, 405);
};
subtest
'GET /not_found'
=>
sub
{
is(
$res
->code, 404);
};
done_testing;
( run in 0.293 second using v1.01-cache-2.11-cpan-bb97c1e446a )