From: adam Date: Thu, 19 Oct 2006 00:23:16 +0000 (+0000) Subject: Added status_bad_request X-Git-Tag: 1.08~294 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=cc186a5b2464125666233dc141c0e26672236102;p=catagits%2FCatalyst-Action-Serialize-Data-Serializer.git Added status_bad_request --- diff --git a/Changelog b/Changelog index f3d2ae8..394952e 100644 --- a/Changelog +++ b/Changelog @@ -3,3 +3,7 @@ Mon Oct 16 14:48:54 PDT 2006 (adam) Created Catalyst::Action::Serialize and Catalyst::Action::Deserialize Added Data::Serializer actions Added status_created helper method + +Wed Oct 18 17:29:07 PDT 2006 (adam) + Added more status_ helpers + diff --git a/lib/Catalyst/Controller/REST.pm b/lib/Catalyst/Controller/REST.pm index 1195f13..33ef165 100644 --- a/lib/Catalyst/Controller/REST.pm +++ b/lib/Catalyst/Controller/REST.pm @@ -61,6 +61,21 @@ sub status_ok { return 1; } +sub status_bad_request { + my $self = shift; + my $c = shift; + my %p = validate(@_, + { + message => { type => SCALAR }, + }, + ); + + $c->response->status(400); + $c->response->content_type('text/plain'); + $c->response->body($p{'message'}); + return 1; +} + sub status_not_found { my $self = shift; my $c = shift;