1 package Test::Catalyst::Action::Serialize;
5 use lib ("$FindBin::Bin/../lib");
10 use Catalyst::Runtime '5.70';
15 name => 'Test::Catalyst::Action::Serialize',
17 'stash_key' => 'rest',
19 'text/x-yaml' => 'YAML',
20 'text/x-data-dumper' => [ 'Data::Serializer', 'Data::Dumper' ],
21 'text/broken' => 'Broken',
28 sub test :Local :ActionClass('Serialize') {
29 my ( $self, $c ) = @_;
30 $c->stash->{'rest'} = {
35 sub test_second :Local :ActionClass('Serialize') {
36 my ( $self, $c ) = @_;
37 $c->stash->{'rest'} = {
46 use Test::More tests => 3;
49 use Data::Dump qw(dump);
51 use lib ("$FindBin::Bin/lib", "$FindBin::Bin/../lib", "$FindBin::Bin/broken");
54 # Should use Data::Dumper, via YAML
55 my $t = Test::Rest->new('content_type' => 'text/x-yaml');
57 use_ok 'Catalyst::Test', 'Test::Catalyst::Action::Serialize';
59 my $req = $t->get(url => '/test');
60 $req->remove_header('Content-Type');
61 $req->header('Accept', 'text/x-yaml');
62 my $res = request($req);
63 ok( $res->is_success, 'GET the serialized request succeeded' );
68 is( $res->content, $data, "Request returned proper data");