>
> And i imagine this new content negotiation helper will make it even more
> powerful. :)
>
Here's a fun hack combining the two, it allows you to intercept and modify
not_found/exception rendering.
hook before_render => sub {
my ($self, $args) = @_;
# Make sure we are rendering the exception template
return unless my $template = $args->{template};
return unless $template eq 'exception';
# Switch to JSON rendering if content negotiation allows it
$args->{json} = {exception => $self->stash('exception')} if
$self->accepts('json');
};
--
sebastian
--
You received this message because you are subscribed to the Google Groups
"Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/groups/opt_out.