Skip to content
Prev Previous commit
Next Next commit
Update 04_charset_server.t
  • Loading branch information
a-adam committed Jan 22, 2014
commit 93332341d6e35d7062af1cc6acf49f2632e3090e
32 changes: 32 additions & 0 deletions t/12_response/04_charset_server.t
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,35 @@ Test::TCP::test_tcp(
Dancer->dance();
},
);

Test::TCP::test_tcp(
client => sub {
my $port = shift;
my $ua = LWP::UserAgent->new;

my $req = HTTP::Request::Common::GET("http://127.0.0.1:$port/unicode-json");
my $res = $ua->request($req);

is $res->content_type, 'application/json';
is_deeply(from_json($res->content), { test => "\x{100}" });
},
server => sub {
my $port = shift;

use lib "t/lib";
use TestAppUnicode;
Dancer::Config->load;

set(
# no charset
environment => 'production',
port => $port,
startup_info => 0,
serializer => 'JSON',
);
Dancer->dance;
},
);