Minima
view release on metacpan or search on metacpan
t/51-stream.t view on Meta::CPAN
my $class = $dir->child('C.pm');
$class->spew(<<~'EOF'
use v5.40;
use experimental 'class';
class C {
field $app :param;
field $route :param;
method a {
sub {
my $w = shift->([ 200, [] ]);
$w->write('streaming');
$w->close;
}
};
}
EOF
);
{
local @INC = ( $dir->absolute, @INC );
# Test object
my $app = Minima::App->new();
my $test = Plack::Test->create(sub { $app->set_env(shift); $app->run });
# Basic responses
my $res = $test->request(GET '/');
is( $res->content, "streaming", 'handles streaming properly' );
$res = $test->request(HEAD '/');
is( length($res->content), 0, 'returns empty body for HEAD (streaming)' );
}
chdir;
done_testing;
( run in 0.232 second using v1.01-cache-2.11-cpan-4d50c553e7e )