added test case for parsing JSON and updated changlog
[catagits/Catalyst-Runtime.git] / t / data_handler.t
1 #!/usr/bin/env perl
2
3 use warnings;
4 use strict;
5
6 use FindBin;
7 use Test::More;
8 use HTTP::Request::Common;
9 use JSON::MaybeXS;
10
11 use lib "$FindBin::Bin/lib";
12 use Catalyst::Test 'TestDataHandlers';
13
14 ok my($res, $c) = ctx_request('/');
15 ok my $message = 'helloworld';
16 ok my $post = encode_json +{message=>$message};
17 ok my $req = POST $c->uri_for_action('/test_json'),
18    Content_Type => 'application/json',
19    Content => $post;
20
21 ok my $response = request $req, 'got a response from a catalyst controller';
22 is $response->content, $message, 'expected content body';
23
24 done_testing;