X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Flib%2FTest%2FCatalyst%2FAction%2FREST%2FController%2FSerialize.pm;h=4056898c921e283ac763cd3589aa30ee975da3e8;hb=9e4398c862fc57d6f9d83f9c64ab3e5e858b9862;hp=4894c024aedcfa67fe3456d5b986591818c6806e;hpb=0d86eca689a3c82e604464aafd6984e2f908b7e4;p=catagits%2FCatalyst-Action-REST.git diff --git a/t/lib/Test/Catalyst/Action/REST/Controller/Serialize.pm b/t/lib/Test/Catalyst/Action/REST/Controller/Serialize.pm index 4894c02..4056898 100644 --- a/t/lib/Test/Catalyst/Action/REST/Controller/Serialize.pm +++ b/t/lib/Test/Catalyst/Action/REST/Controller/Serialize.pm @@ -1,8 +1,9 @@ package Test::Catalyst::Action::REST::Controller::Serialize; -use strict; -use warnings; -use base 'Catalyst::Controller'; +use Moose; +use namespace::autoclean; + +BEGIN { extends 'Catalyst::Controller' } __PACKAGE__->config( 'default' => 'text/x-yaml', @@ -31,4 +32,20 @@ sub test_second :Local :ActionClass('Serialize') { }; } +# For testing saying 'here is an explicitly empty body, do not serialize' +sub empty : Chained('/') PathPart('serialize') CaptureArgs(0) { + my ($self, $c) = @_; + $c->stash( rest => { foo => 'bar' } ); +} + +# Normal case +sub empty_serialized :Chained('empty') Args(0) ActionClass('Serialize') { +} + +# Blank body +sub empty_not_serialized_blank :Chained('empty') Args(0) ActionClass('Serialize') { + my ($self, $c) = @_; + $c->res->body(''); +} + 1;