X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=blobdiff_plain;f=t%2Faggregate%2Flive_component_controller_action_streaming.t;h=f6d93eef36a56d630346f4c340f90dd909239433;hp=4a42e3fe04538a213c6b3f89547e955f41d0a1fd;hb=258733f15e1e1ec4b4d92eda4b4471833890aced;hpb=f397b3064091f4b9f03210d5b630cfd757534c50 diff --git a/t/aggregate/live_component_controller_action_streaming.t b/t/aggregate/live_component_controller_action_streaming.t index 4a42e3f..f6d93ee 100644 --- a/t/aggregate/live_component_controller_action_streaming.t +++ b/t/aggregate/live_component_controller_action_streaming.t @@ -10,7 +10,7 @@ our $iters; BEGIN { $iters = $ENV{CAT_BENCH_ITERS} || 1; } -use Test::More tests => 20*$iters; +use Test::More; use Catalyst::Test 'TestApp'; if ( $ENV{CAT_BENCHMARK} ) { @@ -29,17 +29,18 @@ sub run_tests { ok( my $response = request('http://localhost/streaming'), 'Request' ); ok( $response->is_success, 'Response Successful 2xx' ); is( $response->content_type, 'text/plain', 'Response Content-Type' ); - + is( $response->header('X-Test-Header'), 'valid', 'Headers sent properly' ); + SKIP: { if ( $ENV{CATALYST_SERVER} ) { skip "Using remote server", 1; } - - # XXX: Length should be undef here, but HTTP::Request::AsCGI sets it - is( $response->content_length, 12, 'Response Content-Length' ); + + ok(!defined $response->content_length, 'No Content-Length for streaming responses'); + is(length $response->content, 12, 'Response content' ); } - + is( $response->content,, <<'EOF', 'Content is a stream' ); foo bar @@ -67,6 +68,7 @@ EOF ok( $response->is_success, 'Response Successful 2xx' ); is( $response->content_type, 'text/plain', 'Response Content-Type' ); is( $response->content_length, -s $file, 'Response Content-Length' ); + is( $response->header('X-Test-Header'), 'valid', 'Headers sent properly' ); is( $response->content, $buffer, 'Content is read from filehandle' ); ok( $response = request('http://localhost/action/streaming/body_glob'), @@ -74,6 +76,7 @@ EOF ok( $response->is_success, 'Response Successful 2xx' ); is( $response->content_type, 'text/plain', 'Response Content-Type' ); is( $response->content_length, -s $file, 'Response Content-Length' ); + is( $response->header('X-Test-Header'), 'valid', 'Headers sent properly' ); is( $response->content, $buffer, 'Content is read from filehandle' ); } @@ -83,7 +86,10 @@ EOF ok( my $response = request('http://localhost/action/streaming/body_large'), 'Request' ); ok( $response->is_success, 'Response Successful 2xx' ); is( $response->content_type, 'text/plain', 'Response Content-Type' ); + is( $response->header('X-Test-Header'), 'valid', 'Headers sent properly' ); is( $response->content_length, $size, 'Response Content-Length' ); is( $response->content, "\0" x $size, 'Content is read from filehandle' ); } } + +done_testing;