X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Flib%2FTestFromPSGI%2FController%2FRoot.pm;h=1f824534e44212aba768483979aaaae2373fa71e;hb=f152ae23b886a4f0bcfaeaf401ea2bf71cd30ab1;hp=7c116a5867a761ec5fd82f99e21a0412b739d271;hpb=952ff53094bcabafb62064922bf33f5a0269450f;p=catagits%2FCatalyst-Runtime.git diff --git a/t/lib/TestFromPSGI/Controller/Root.pm b/t/lib/TestFromPSGI/Controller/Root.pm index 7c116a5..1f82453 100644 --- a/t/lib/TestFromPSGI/Controller/Root.pm +++ b/t/lib/TestFromPSGI/Controller/Root.pm @@ -1,13 +1,56 @@ -package TestMiddleware::Controller::Root; +package TestFromPSGI::Controller::Root; use Moose; use MooseX::MethodAttributes; extends 'Catalyst::Controller'; -sub default : Path { } -sub welcome : Path(welcome) { - pop->res->body('Welcome to Catalyst'); +sub test_psgi_keys :Local { + my ($self, $c) = @_; + $c->res->body('ok'); +} + +sub from_psgi_array : Local { + my ($self, $c) = @_; + my $res = sub { + my ($env) = @_; + return [200, ['Content-Type'=>'text/plain'], + [qw/hello world today/]]; + }->($c->req->env); + + $c->res->from_psgi_response($res); +} + +sub from_psgi_code : Local { + my ($self, $c) = @_; + + my $res = sub { + my ($env) = @_; + return sub { + my $responder = shift; + return $responder->([200, ['Content-Type'=>'text/plain'], + [qw/hello world today2/]]); + }; + }->($c->req->env); + + $c->res->from_psgi_response($res); +} + +sub from_psgi_code_itr : Local { + my ($self, $c) = @_; + my $res = sub { + my ($env) = @_; + return sub { + my $responder = shift; + my $writer = $responder->([200, ['Content-Type'=>'text/plain']]); + $writer->write('hello'); + $writer->write('world'); + $writer->write('today3'); + $writer->close; + }; + }->($c->req->env); + + $c->res->from_psgi_response($res); } __PACKAGE__->meta->make_immutable;