Added an optional mode for RFC 7231 compliance. The Content-Type header is used to...
[catagits/Catalyst-Action-REST.git] / t / callback.t
1 use strict;
2 use warnings;
3 use Test::More;
4 use FindBin;
5
6 use lib ("$FindBin::Bin/lib", "$FindBin::Bin/../lib");
7 use Test::Rest;
8
9 use_ok 'Catalyst::Test', 'Test::Serialize';
10
11 my $t = Test::Rest->new('content_type' => 'text/my-csv');
12
13 my $has_serializer = eval "require XML::Simple";
14
15     my $monkey_template = {
16         monkey => 'likes chicken!',
17     };
18     my $mres = request($t->get(url => '/monkey_get'));
19     ok( $mres->is_success, 'GET the monkey succeeded' );
20     my $output = { split( /,/, $mres->content ) };
21     is_deeply($output, $monkey_template, "GET returned the right data");
22
23     my $post_data = {
24         'sushi' => 'is good for monkey',
25     };
26     my $mres_post = request( $t->post( url => '/monkey_put', data => join( ',', %$post_data ) ) );
27     ok( $mres_post->is_success, "POST to the monkey succeeded");
28     is_deeply($mres_post->content, "is good for monkey", "POST data matches");
29
30 1;
31
32 done_testing;