7 use lib "$FindBin::Bin/lib";
11 BEGIN { $iters = $ENV{CAT_BENCH_ITERS} || 1; }
13 use Test::More tests => 10*$iters;
14 use Catalyst::Test 'TestApp';
16 if ( $ENV{CAT_BENCHMARK} ) {
18 Benchmark::timethis( $iters, \&run_tests );
27 # test direct streaming
29 ok( my $response = request('http://localhost/streaming'), 'Request' );
30 ok( $response->is_success, 'Response Successful 2xx' );
31 is( $response->content_type, 'text/plain', 'Response Content-Type' );
32 # XXX: Length should be undef here, but HTTP::Request::AsCGI sets it
33 is( $response->content_length, 12, 'Response Content-Length' );
34 is( $response->content,, <<'EOF', 'Content is a stream' );
41 # test streaming by passing a handle to $c->res->body
44 if ( $ENV{CATALYST_SERVER} ) {
45 skip "Using remote server", 5;
48 my $file = "$FindBin::Bin/01use.t";
49 my $fh = IO::File->new( $file, 'r' );
52 $fh->read( $buffer, 1024 );
56 ok( my $response = request('http://localhost/action/streaming/body'),
58 ok( $response->is_success, 'Response Successful 2xx' );
59 is( $response->content_type, 'text/plain', 'Response Content-Type' );
60 is( $response->content_length, -s $file, 'Response Content-Length' );
61 is( $response->content, $buffer, 'Content is read from filehandle' );