1 package Test::Catalyst::Action::REST::Controller::Serialize;
4 use namespace::autoclean;
6 BEGIN { extends 'Catalyst::Controller' }
9 'default' => 'text/x-yaml',
10 'stash_key' => 'rest',
12 'text/x-data-dumper' => [ 'Data::Serializer', 'Data::Dumper' ],
16 sub test :Local :ActionClass('Serialize') {
17 my ( $self, $c ) = @_;
18 $c->stash->{'rest'} = {
23 sub test_second :Local :ActionClass('Serialize') {
24 my ( $self, $c ) = @_;
25 # 'serialize_content_type' is configured in the test config in t/conf
26 $c->stash->{'serialize_content_type'} = $c->req->params->{'serialize_content_type'};
27 $c->stash->{'rest'} = {
32 # For testing saying 'here is an explicitly empty body, do not serialize'
33 sub empty : Chained('/') PathPart('serialize') CaptureArgs(0) {
35 $c->stash( rest => { foo => 'bar' } );
39 sub empty_serialized :Chained('empty') Args(0) ActionClass('Serialize') {
43 sub empty_not_serialized_blank :Chained('empty') Args(0) ActionClass('Serialize') {
48 # Explicitly set a view
49 sub explicit_view :Chained('empty') Args(0) ActionClass('Serialize') {
51 $c->stash->{current_view} = '';