diff options
Diffstat (limited to '')
| -rw-r--r-- | lib/presque/Role/Response.pm | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/lib/presque/Role/Response.pm b/lib/presque/Role/Response.pm index 4f0960f..8f9aa76 100644 --- a/lib/presque/Role/Response.pm +++ b/lib/presque/Role/Response.pm @@ -23,4 +23,33 @@ sub _set_response_content_type { $self->response->header('Content-Type' => 'application/json'); } +sub entity { + my ($self, $content) = @_; + $self->finish(JSON::encode_json($content)); +} + 1; +=head1 NAME + +presque::Role::Response + +=head1 DESCRIPTION + +Set the B<Content-Type> header of the response to 'application/json', and serialize to L<JSON> the body. + +=head1 AUTHOR + +franck cuny E<lt>franck@lumberjaph.netE<gt> + +=head1 SEE ALSO + +=head1 LICENSE + +Copyright 2010 by Linkfluence + +L<http://linkfluence.net> + +This library is free software; you can redistribute it and/or modify +it under the same terms as Perl itself. + +=cut |
