Merge branch 'master' into psgi
[catagits/Catalyst-Runtime.git] / t / lib / TestApp / Controller / Action / Streaming.pm
index f619a7d..a5b2c81 100644 (file)
@@ -16,8 +16,8 @@ EOF
 
 sub body : Local {
     my ( $self, $c ) = @_;
-    
-    my $file = "$FindBin::Bin/../01use.t";
+
+    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;