X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=blobdiff_plain;f=t%2Fpsgi_utils.t;h=6508886bcdc02d5be80f125b4c2e392c38474294;hp=9c055596326b8da59ffdaf17728c732ebdfd6d08;hb=88e5a8b0c4d28e46b8ba6b6b9567063e57af9063;hpb=b194746d5368ff5d1b65d667f04991a780e01a1b diff --git a/t/psgi_utils.t b/t/psgi_utils.t index 9c05559..6508886 100644 --- a/t/psgi_utils.t +++ b/t/psgi_utils.t @@ -43,6 +43,18 @@ my $psgi_app = sub { $psgi_app->($env)); } + sub filehandle :Local { + my ($self, $c, $arg) = @_; + my $path = File::Spec->catfile('t', 'utf8.txt'); + open(my $fh, '<', $path) || die "trouble: $!"; + $c->res->from_psgi_response([200, ['Content-Type'=>'text/html'], $fh]); + } + + sub direct :Local { + my ($self, $c, $arg) = @_; + $c->res->from_psgi_response([200, ['Content-Type'=>'text/html'], ["hello","world"]]); + } + package MyApp::Controller::User; $INC{'MyApp/Controller/User.pm'} = __FILE__; @@ -110,7 +122,7 @@ my $psgi_app = sub { $c->res->body("$uri"); } - + sub get_env { my ($self, $c) = @_; if($c->req->query_parameters->{path_prefix}) { @@ -243,7 +255,7 @@ use Catalyst::Test 'MyApp'; # END [/user/local_example_args1/***/] -# BEGIN [/user/path-example] +# BEGIN [/user/path-example] { my ($res, $c) = ctx_request('/user/path-example'); @@ -383,4 +395,16 @@ use Catalyst::Test 'MyApp'; is_deeply $c->req->args, [111]; } +{ + use utf8; + use Encode; + my ($res, $c) = ctx_request('/docs/filehandle'); + is Encode::decode_utf8($res->content), "

This is stream_body_fh action ♥

\n"; +} + +{ + my ($res, $c) = ctx_request('/docs/direct'); + is $res->content, "helloworld"; +} + done_testing();