Fixed a bug where c->read didn't work properly, and added some tests for parse_on_dem...
[catagits/Catalyst-Runtime.git] / t / lib / TestAppOnDemand / Controller / Body.pm
1 package TestAppOnDemand::Controller::Body;
2
3 use strict;
4 use base 'Catalyst::Base';
5
6 use Data::Dump ();
7
8 sub params : Local {
9     my ( $self, $c ) = @_;
10
11     $c->res->body( Data::Dump::dump( $c->req->body_parameters ) );
12 }
13
14 sub read : Local {
15     my ( $self, $c ) = @_;
16     
17     # read some data
18     my @chunks;
19     
20     while ( my $data = $c->read( 10_000 ) ) {
21         push @chunks, $data;
22     }
23
24     $c->res->content_type( 'text/plain');
25     
26     $c->res->body( join ( '|', map { length $_ } @chunks ) );
27 }
28
29 1;