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=923defb1adb95ddd7a59884773b2b3981350f73a;hp=6508886bcdc02d5be80f125b4c2e392c38474294;hb=75a7c429032fcfea6805a0cfedcedabb656e9931;hpb=88e5a8b0c4d28e46b8ba6b6b9567063e57af9063 diff --git a/t/psgi_utils.t b/t/psgi_utils.t index 6508886..923defb 100644 --- a/t/psgi_utils.t +++ b/t/psgi_utils.t @@ -55,6 +55,28 @@ my $psgi_app = sub { $c->res->from_psgi_response([200, ['Content-Type'=>'text/html'], ["hello","world"]]); } + sub streaming_body :Local { + my ($self, $c) = @_; + my $psgi_app = sub { + my $respond = shift; + my $writer = $respond->([200,["Content-Type" => "text/plain"]]); + $writer->write("body"); + $writer->close; + }; + $c->res->from_psgi_response($psgi_app); + } + sub streaming_body_with_charset :Local { + my ($self, $c) = @_; + my $psgi_app = sub { + my $respond = shift; + my $writer = $respond->([200,["Content-Type" => "text/plain; charset=utf-8"]]); + $writer->write("body"); + $writer->close; + }; + $c->clear_encoding; + $c->res->from_psgi_response($psgi_app); + } + package MyApp::Controller::User; $INC{'MyApp/Controller/User.pm'} = __FILE__; @@ -407,4 +429,13 @@ use Catalyst::Test 'MyApp'; is $res->content, "helloworld"; } +{ + my ($res, $c) = ctx_request('/docs/streaming_body'); + is $res->content, "body"; +} +{ + my ($res, $c) = ctx_request('/docs/streaming_body_with_charset'); + is $res->content, "body"; +} + done_testing();