From: Gerda Shank Date: Thu, 28 May 2015 17:24:12 +0000 (-0400) Subject: add test for encoding in $c->res->body after a ->write X-Git-Tag: 5.90094~9 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=commitdiff_plain;h=1728aeb70afd529fb0f529eedf1c117751173e6d add test for encoding in $c->res->body after a ->write --- diff --git a/t/utf_incoming.t b/t/utf_incoming.t index 6342025..6c0205d 100644 --- a/t/utf_incoming.t +++ b/t/utf_incoming.t @@ -111,6 +111,14 @@ use Scalar::Util (); $c->response->body($contents); } + sub write_then_body :Local { + my ($self, $c) = @_; + $c->clear_encoding; + $c->res->content_type('text/plain'); + $c->res->write("

This is early_write action ♥

"); + $c->res->body("

This is body_write action ♥

"); + } + sub file_upload :POST Consumes(Multipart) Local { my ($self, $c) = @_; Test::More::is $c->req->body_parameters->{'♥'}, '♥♥'; @@ -365,6 +373,14 @@ use Catalyst::Test 'MyApp'; } { + my $res = request "/root/write_then_body"; + + is $res->code, 200, 'OK'; + is decode_utf8($res->content), "

This is early_write action ♥

This is body_write action ♥

"; + is $res->content_charset, 'UTF-8'; +} + +{ ok my $path = File::Spec->catfile('t', 'utf8.txt'); ok my $req = POST '/root/file_upload', Content_Type => 'form-data',