use Module::Pluggable::Object;
use MRO::Compat;
-our $VERSION = '1.10';
-$VERSION = eval $VERSION;
-
has _encoders => (
is => 'ro',
isa => 'HashRef',
return 1 if defined $c->stash->{current_view};
return 1 if defined $c->stash->{current_view_instance};
+ # on 3xx responses, serialize if there's something to
+ # serialize, no-op if not
+ my $stash_key = (
+ $controller->{'serialize'} ?
+ $controller->{'serialize'}->{'stash_key'} :
+ $controller->{'stash_key'}
+ ) || 'rest';
+ return 1 if $c->response->status =~ /^(?:3\d\d)$/ && ! defined $c->stash->{$stash_key};
+
my ( $sclass, $sarg, $content_type ) =
$self->_load_content_plugins( "Catalyst::Action::Serialize",
$controller, $c );
For building custom error responses when serialization fails, you can create
an ActionRole (and use L<Catalyst::Controller::ActionRole> to apply it to the
-C<end> action) which overrides C<unsupported_media_type> and/or C<_serialize_bad_request>
+C<end> action) which overrides C<unsupported_media_type> and/or C<serialize_bad_request>
methods.
=head1 SEE ALSO