diff options
author | franck cuny <franck@lumberjaph.net> | 2010-06-23 21:05:09 +0200 |
---|---|---|
committer | franck cuny <franck@lumberjaph.net> | 2010-06-23 21:05:09 +0200 |
commit | 9e851fb0ed7d9c68e5c447ec25d9a505dce9321a (patch) | |
tree | 51e36bf1cef40da0a1837d3072e5a89a8cc932c9 /lib/presque/Role | |
parent | fix bug with uuid and add unique (diff) | |
download | presque-9e851fb0ed7d9c68e5c447ec25d9a505dce9321a.tar.gz |
remove before for http methods, set content type before finish
Diffstat (limited to 'lib/presque/Role')
-rw-r--r-- | lib/presque/Role/Response.pm | 21 |
1 files changed, 2 insertions, 19 deletions
diff --git a/lib/presque/Role/Response.pm b/lib/presque/Role/Response.pm index 8f9aa76..a3944f3 100644 --- a/lib/presque/Role/Response.pm +++ b/lib/presque/Role/Response.pm @@ -2,27 +2,10 @@ package presque::Role::Response; use Moose::Role; -before get => sub { - (shift)->_set_response_content_type; +before finish => sub { + (shift)->response->header('Content-Type' => 'application/json'); }; -before put => sub { - (shift)->_set_response_content_type; -}; - -before post => sub { - (shift)->_set_response_content_type; -}; - -before delete => sub { - (shift)->_set_response_content_type; -}; - -sub _set_response_content_type { - my $self = shift; - $self->response->header('Content-Type' => 'application/json'); -} - sub entity { my ($self, $content) = @_; $self->finish(JSON::encode_json($content)); |