6 use lib ("$FindBin::Bin/lib", "$FindBin::Bin/../lib");
11 plan skip_all => 'Install JSON 2.12 or later to run this test' if ($@);
15 use_ok 'Catalyst::Test', 'Test::Serialize';
17 my $json = JSON->new->utf8;
18 # The text/x-json should throw a warning
19 for ('text/x-json', 'application/json') {
20 my $t = Test::Rest->new('content_type' => $_);
21 my $monkey_template = {
22 monkey => 'likes chicken!',
24 my $mres = request($t->get(url => '/monkey_get'));
25 ok( $mres->is_success, 'GET the monkey succeeded' );
26 is_deeply($json->decode($mres->content), $monkey_template, "GET returned the right data");
29 'sushi' => 'is good for monkey',
32 my $mres_post = request($t->post(url => '/monkey_put', data => $json->encode($post_data)));
33 ok( $mres_post->is_success, "POST to the monkey succeeded");
34 my $exp = "is good for monkey 佐藤 純";
36 is_deeply($mres_post->content, $exp, "POST data matches");