X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=blobdiff_plain;f=t%2Futf_incoming.t;h=76eaa876a016e81e4ad7d319572ea2c580295502;hp=373a4286c89358c0ecca0e5158b63cd121681526;hb=d200092825d92139d59f660eaa895790442cdf8b;hpb=69fa672de392417867c1972c924a6f69b1bca829 diff --git a/t/utf_incoming.t b/t/utf_incoming.t index 373a428..76eaa87 100644 --- a/t/utf_incoming.t +++ b/t/utf_incoming.t @@ -3,6 +3,7 @@ use warnings; use strict; use Test::More; use HTTP::Request::Common; +use HTTP::Message::PSGI (); use Encode 2.21 'decode_utf8', 'encode_utf8'; use File::Spec; use JSON::MaybeXS; @@ -167,10 +168,25 @@ use JSON::MaybeXS; sub override_encoding :Local { my ($self, $c) = @_; $c->res->content_type('text/plain'); + $c->encoding(Encode::find_encoding('UTF-8')); $c->encoding(Encode::find_encoding('Shift_JIS')); $c->response->body("テスト"); } + sub stream_write_error :Local { + my ($self, $c) = @_; + $c->response->content_type('text/html'); + $c->response->write("

This is stream_write action ♥

"); + $c->encoding(Encode::find_encoding('Shift_JIS')); + $c->response->write("

This is stream_write action ♥

"); + } + + sub from_external_psgi :Local { + my ($self, $c) = @_; + my $env = HTTP::Message::PSGI::req_to_psgi( HTTP::Request::Common::GET '/root/♥'); + $c->res->from_psgi_response( ref($c)->to_app->($env)); + } + package MyApp; use Catalyst; @@ -395,6 +411,22 @@ SKIP: { is $res->content_charset, 'UTF-8'; } +{ + my $res = request "/root/stream_write_error"; + + is $res->code, 200, 'OK'; + like decode_utf8($res->content), qr[

This is stream_write action ♥

code, 200, 'OK'; + is decode_utf8($res->content), '

This is path-heart action ♥

', 'correct body'; + is $res->content_length, 36, 'correct length'; + is $res->content_charset, 'UTF-8'; +} + ## should we use binmode on filehandles to force the encoding...? ## Not sure what else to do with multipart here, if docs are enough...