Skip to content

Commit

Permalink
more accepts examples
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Feb 4, 2014
1 parent f5f0bd2 commit d0cfc92
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/Mojolicious/Plugin/DefaultHelpers.pm
Expand Up @@ -139,8 +139,13 @@ header, C<format> stash value or C<format> GET/POST parameter with
L<Mojolicious::Renderer/"accepts">, defaults to returning the first extension
if no preference could be detected.
# Check if JSON is acceptable
$self->render(json => {hello => 'world'}) if $self->accepts('json');
# Unsupported representation
$self->render(data => '', status => 204)
unless my $format = $self->accepts('html', 'json');
=head2 app
%= app->secrets->[0]
Expand Down

0 comments on commit d0cfc92

Please sign in to comment.