[libdancer-plugin-rest-perl] 21/63: check for supported format request in before filter
Jonas Smedegaard
dr at jones.dk
Wed Jul 2 11:44:51 UTC 2014
This is an automated email from the git hooks/post-receive script.
js pushed a commit to annotated tag 0.07
in repository libdancer-plugin-rest-perl.
commit 43458447f83e542a073664f569a2b22de37e1cf8
Author: Alexis Sukrieh <sukria at sukria.net>
Date: Wed May 5 11:42:28 2010 +0200
check for supported format request in before filter
---
lib/Dancer/Plugin/REST.pm | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/lib/Dancer/Plugin/REST.pm b/lib/Dancer/Plugin/REST.pm
index ffee624..432233e 100644
--- a/lib/Dancer/Plugin/REST.pm
+++ b/lib/Dancer/Plugin/REST.pm
@@ -22,9 +22,13 @@ sub {
before sub {
my $format = params->{'format'};
return unless defined $format;
-
+
my $serializer = $serializers->{$format};
- return unless defined $serializer;
+ unless (defined $serializer) {
+ return halt(Dancer::Error->new(
+ code => 404,
+ message => "unsupported format requested: ".$format));
+ }
set serializer => $serializer;
};
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libdancer-plugin-rest-perl.git
More information about the Pkg-perl-cvs-commits
mailing list