+ [x] /engine/request/body.t
[x] /engine/request/cookies.t
[x] /engine/request/headers.t
[ ] /engine/request/method/get.t
[ ] /engine/request/method/post/urlencoded.t
[x] /engine/request/parameters.t
[ ] /engine/request/unicode.t
- [~] /engine/request/uploads.t
+ [x] /engine/request/uploads.t
[x] /engine/response/cookies.t
[x] /engine/response/errors.t
[ ] /view/subclass.t
[ ] /view/unicode.t
- [ ] /controller/action/absolute.t
- [ ] /controller/action/arguments.t
- [ ] /controller/action/begin.t
- [ ] /controller/action/default.t
- [ ] /controller/action/end.t
- [ ] /controller/action/forward.t
- [ ] /controller/action/inheritance.t
- [ ] /controller/acrion/private.t
- [ ] /controller/action/public.t
- [ ] /controller/action/regexp.t
- [ ] /controller/action/relative.t
+ [ ] /component/controller/action/arguments.t
+ [~] /component/controller/action/begin.t
+ [~] /component/controller/action/default.t
+ [~] /component/controller/action/end.t
+ [~] /component/controller/action/forward.t
+ [~] /component/controller/action/global.t
+ [~] /component/controller/action/inheritance.t
+ [~] /component/controller/action/local.t
+ [~] /component/controller/action/path.t
+ [~] /component/controller/acrion/private.t
+ [ ] /component/controller/action/public.t
+ [~] /component/controller/action/regexp.t
[ ] /plugin/overload/finalize.t
[ ] /plugin/overload/finalize_output.t
use FindBin;
use lib "$FindBin::Bin/../../lib";
-use Test::More tests => 10;
+use Test::More tests => 20;
use Catalyst::Test 'TestApp';
use Catalyst::Request;
is( $creq->content_length, $request->content_length, 'Catalyst::Request Content-Length' );
is( $creq->body, $request->content, 'Catalyst::Request Content' );
}
+
+{
+ my $creq;
+
+ my $request = POST( 'http://localhost/dump/request/',
+ 'Content-Type' => 'text/plain',
+ 'Content' => 'x' x 100_000
+ );
+
+ ok( my $response = request($request), 'Request' );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ is( $response->content_type, 'text/plain', 'Response Content-Type' );
+ like( $response->content, qr/^bless\( .* 'Catalyst::Request' \)$/s, 'Content is a serialized Catalyst::Request' );
+
+ {
+ no strict 'refs';
+ ok( eval '$creq = ' . $response->content, 'Unserialize Catalyst::Request' );
+ }
+
+ isa_ok( $creq, 'Catalyst::Request' );
+ is( $creq->method, 'POST', 'Catalyst::Request method' );
+ is( $creq->content_type, 'text/plain', 'Catalyst::Request Content-Type' );
+ is( $creq->content_length, $request->content_length, 'Catalyst::Request Content-Length' );
+ is( $creq->body, $request->content, 'Catalyst::Request Content' );
+}
\ No newline at end of file
# Query string. I'm not sure the order is consistent in all enviroments,
# we need to test this with:
- # [x] C::E::Test and C::E::Daemon
- # [ ] MP1
- # [ ] MP2
- # [x] CGI::Simple
+ # [x] C::E::Test and C::E::HTTP
+ # [x] MP13
+ # [x] MP19
+ # [x] MP20
+ # [x] CGI
unshift( @{ $parameters->{a} }, 1, 2, 3 );
use FindBin;
use lib "$FindBin::Bin/../../lib";
-use Test::More tests => 18;
+use Test::More tests => 39;
use Catalyst::Test 'TestApp';
use Catalyst::Request;
is( $upload->size, length( $part->content ), 'Upload Content-Length' );
}
}
+
+{
+ my $creq;
+
+ my $request = POST( 'http://localhost/dump/request/',
+ 'Content-Type' => 'multipart/form-data',
+ 'Content' => [
+ 'testfile' => [ "$FindBin::Bin/cookies.t" ],
+ 'testfile' => [ "$FindBin::Bin/headers.t" ],
+ 'testfile' => [ "$FindBin::Bin/uploads.t" ],
+ ]
+ );
+
+ ok( my $response = request($request), 'Request' );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ is( $response->content_type, 'text/plain', 'Response Content-Type' );
+ like( $response->content, qr/^bless\( .* 'Catalyst::Request' \)$/s, 'Content is a serialized Catalyst::Request' );
+
+ {
+ no strict 'refs';
+ ok( eval '$creq = ' . $response->content, 'Unserialize Catalyst::Request' );
+ }
+
+ isa_ok( $creq, 'Catalyst::Request' );
+ is( $creq->method, 'POST', 'Catalyst::Request method' );
+ is( $creq->content_type, 'multipart/form-data', 'Catalyst::Request Content-Type' );
+ is( $creq->content_length, $request->content_length, 'Catalyst::Request Content-Length' );
+
+ my @parts = $request->parts;
+
+ for ( my $i = 0; $i < @parts; $i++ ) {
+
+ my $part = $parts[$i];
+ my $disposition = $part->header('Content-Disposition');
+ my %parameters = @{ ( split_header_words($disposition) )[0] };
+
+ my $upload = $creq->uploads->{ $parameters{name} }->[$i];
+
+ isa_ok( $upload, 'Catalyst::Request::Upload' );
+ is( $upload->type, $part->content_type, 'Upload Content-Type' );
+ is( $upload->filename, $parameters{filename}, 'Upload filename' );
+ is( $upload->size, length( $part->content ), 'Upload Content-Length' );
+ }
+}
use strict;
use Catalyst qw[Test::Errors Test::Headers];
+use Catalyst::Utils;
our $VERSION = '0.01';
$method = $1;
}
- my $executed = sprintf( "%s->%s", $class, $method )
- if ( $class && $method );
-
- $c->response->headers->push_header( 'X-Catalyst-Executed' => $executed );
+ if ( $class && $method ) {
+ my $executed = sprintf( "%s->%s", $class, $method );
+ $c->response->headers->push_header( 'X-Catalyst-Executed' => $executed );
+ }
+
return $c->SUPER::execute(@_);
}