5 use Test::Requires qw(JSON::MaybeXS);
7 use lib ("$FindBin::Bin/lib", "$FindBin::Bin/../lib");
11 use_ok 'Catalyst::Test', 'Test::Serialize', 'Catalyst::Action::Serialize::JSON';
13 my $json = JSON->new->utf8;
15 for ('text/javascript','application/x-javascript','application/javascript') {
16 my $t = Test::Rest->new('content_type' => $_);
17 my $monkey_template = { monkey => 'likes chicken!' };
19 my $mres = request($t->get(url => '/monkey_get?callback=My_Animal.omnivore'));
20 ok( $mres->is_success, 'GET the monkey succeeded' );
22 my ($json_param) = $mres->content =~ /^My_Animal.omnivore\((.*)?\);$/;
23 is_deeply($json->decode($json_param), $monkey_template, "GET returned the right data");