Catalyst-Runtime
view release on metacpan or search on metacpan
t/body_fh.t view on Meta::CPAN
is $body->[0], 'Hello flat_response';
});
}
{
ok(my $env = req_to_psgi(GET '/root/memory_stream'));
ok(my $psgi_response = $psgi->($env));
$psgi_response->(sub {
my $response_tuple = shift;
my ($status, $headers, $body) = @$response_tuple;
ok $status;
ok $headers;
is ref($body), 'GLOB';
});
}
{
ok(my $env = req_to_psgi(GET '/root/manual_write_fh'));
ok(my $psgi_response = $psgi->($env));
$psgi_response->(sub {
my $response_tuple = shift;
my ($status, $headers, $body) = @$response_tuple;
ok $status;
ok $headers;
ok !$body;
return Plack::Util::inline_object(
write => sub { is shift, 'Hello manual_write_fh' },
close => sub { ok 1, 'closed' },
);
});
}
{
ok(my $env = req_to_psgi(GET '/root/manual_write'));
ok(my $psgi_response = $psgi->($env));
$psgi_response->(sub {
my $response_tuple = shift;
my ($status, $headers, $body) = @$response_tuple;
ok $status;
ok $headers;
ok !$body;
my @expected = (qw/Hello manual_write/);
return Plack::Util::inline_object(
close => sub { ok 1, 'closed'; is scalar(@expected), 0; },
write => sub { is shift, shift(@expected) },
);
});
}
## We need to specify the number of expected tests because tests that live
## in the callbacks might never get run (thus all ran tests pass but not all
## required tests run).
done_testing(28);
( run in 2.332 seconds using v1.01-cache-2.11-cpan-39bf76dae61 )