1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
|
use strict;
use warnings;
use Test::More;
use FindBin;
use lib "$FindBin::Bin/lib";
use Plack::Test;
use Plack::Builder;
use Plack::Middleware::Magpie;
use HTTP::Request::Common;
my $named_handler = builder {
enable "Magpie", pipeline => [qw( Magpie::Pipeline::Error::Named Magpie::Pipeline::Moe Magpie::Pipeline::Curly )];
};
test_psgi
app => $named_handler,
client => sub {
my $cb = shift;
my $res = $cb->(GET "http://localhost/");
is $res->code, 418;
};
my $numeric_handler = builder {
enable "Magpie", pipeline => [qw( Magpie::Pipeline::Error::Numeric Magpie::Pipeline::Moe Magpie::Pipeline::Curly )];
};
test_psgi
app => $numeric_handler,
client => sub {
my $cb = shift;
my $res = $cb->(GET "http://localhost/");
is $res->code, 418;
};
my $hashref_handler = builder {
enable "Magpie", pipeline => [qw( Magpie::Pipeline::Error::Hashref Magpie::Pipeline::Moe Magpie::Pipeline::Curly )];
};
test_psgi
app => $hashref_handler,
client => sub {
my $cb = shift;
my $res = $cb->(GET "http://localhost/");
is $res->code, 418;
};
done_testing;
|