Catalyst-Seal
view release on metacpan or search on metacpan
t/61-dispatch-method.t view on Meta::CPAN
sub body {
my (%over) = @_;
my $res = SealTest::response($app, %over);
return $res->[0] . ' ' . join('', @{ $res->[2] || [] });
}
# ------------------------------------------- a failed match must not stick
# A GET of a POST-only path is a legitimate 404. It must not decide anything
# for the POST that follows: one unauthenticated GET would otherwise disable
# the endpoint for the life of the worker.
{
is(body(PATH_INFO => '/guard/post', REQUEST_METHOD => 'POST'),
'200 post-only', 'the POST route works to begin with');
my $get = body(PATH_INFO => '/guard/post', REQUEST_METHOD => 'GET');
isnt($get, '200 post-only', 'a GET of a POST-only path does not reach the action');
is(body(PATH_INFO => '/guard/post', REQUEST_METHOD => 'POST'),
'200 post-only', 'and the POST still works after that GET');
( run in 1.918 second using v1.01-cache-2.11-cpan-036bef1c656 )