Commit | Line | Data |
878b821c |
1 | package TestAppOnDemand::Controller::Body; |
2 | |
3 | use strict; |
c057ae86 |
4 | use base 'Catalyst::Controller'; |
878b821c |
5 | |
6 | use Data::Dump (); |
7 | |
cb5b55f9 |
8 | sub body_params : Local { |
878b821c |
9 | my ( $self, $c ) = @_; |
10 | |
11 | $c->res->body( Data::Dump::dump( $c->req->body_parameters ) ); |
12 | } |
13 | |
cb5b55f9 |
14 | sub query_params : Local { |
15 | my ( $self, $c ) = @_; |
16 | |
17 | $c->res->body( Data::Dump::dump( $c->req->query_parameters ) ); |
18 | } |
19 | |
20 | sub params : Local { |
21 | my ( $self, $c ) = @_; |
22 | |
23 | $c->res->body( Data::Dump::dump( $c->req->parameters ) ); |
24 | } |
25 | |
878b821c |
26 | sub read : Local { |
27 | my ( $self, $c ) = @_; |
28 | |
29 | # read some data |
30 | my @chunks; |
31 | |
32 | while ( my $data = $c->read( 10_000 ) ) { |
33 | push @chunks, $data; |
34 | } |
35 | |
36 | $c->res->content_type( 'text/plain'); |
37 | |
38 | $c->res->body( join ( '|', map { length $_ } @chunks ) ); |
39 | } |
40 | |
c057ae86 |
41 | 1; |