X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Flib%2FTestApp%2FController%2FAction%2FStreaming.pm;h=a5b2c81b980961e0798eaeac85329fbee183293c;hb=f397b3064091f4b9f03210d5b630cfd757534c50;hp=f1a290853441e9f2bf78cc8517640d1ba2906f5d;hpb=361359b59a0523c90962bc4f7a78562630fafe80;p=catagits%2FCatalyst-Runtime.git diff --git a/t/lib/TestApp/Controller/Action/Streaming.pm b/t/lib/TestApp/Controller/Action/Streaming.pm index f1a2908..a5b2c81 100644 --- a/t/lib/TestApp/Controller/Action/Streaming.pm +++ b/t/lib/TestApp/Controller/Action/Streaming.pm @@ -16,8 +16,8 @@ EOF sub body : Local { my ( $self, $c ) = @_; - - my $file = "$FindBin::Bin/lib/TestApp/Controller/Action/Streaming.pm"; + + my $file = "$FindBin::Bin/../lib/TestApp/Controller/Action/Streaming.pm"; my $fh = IO::File->new( $file, 'r' ); if ( defined $fh ) { $c->res->body( $fh ); @@ -27,4 +27,29 @@ sub body : Local { } } +sub body_glob : Local { + my ( $self, $c ) = @_; + + my $file = "$FindBin::Bin/../lib/TestApp/Controller/Action/Streaming.pm"; + open my $fh, '<', $file; + if ( defined $fh ) { + $c->res->body( $fh ); + } + else { + $c->res->body( "Unable to read $file" ); + } +} + +sub body_large : Local { + my ($self, $c) = @_; + + # more than one write with the default chunksize + my $size = 128 * 1024; + + my $data = "\0" x $size; + open my $fh, '<', \$data; + $c->res->content_length($size); + $c->res->body($fh); +} + 1;