7 use lib "$FindBin::Bin/../../../lib";
11 BEGIN { $iters = $ENV{CAT_BENCH_ITERS} || 2; }
13 use Test::More tests => 8*$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 is( $response->content,, <<'EOF', 'Content is a stream' );
39 # test streaming by passing a handle to $c->res->body
42 if ( $ENV{CATALYST_SERVER} ) {
43 skip "Using remote server", 4;
46 my $file = "$FindBin::Bin/../../../../01use.t";
47 my $fh = IO::File->new( $file, 'r' );
50 $fh->read( $buffer, 1024 );
54 ok( my $response = request('http://localhost/action/streaming/body'),
56 ok( $response->is_success, 'Response Successful 2xx' );
57 is( $response->content_type, 'text/plain', 'Response Content-Type' );
58 is( $response->content, $buffer, 'Content is read from filehandle' );