[libdancer-plugin-rest-perl] 45/63: FIX content_types

Jonas Smedegaard dr at jones.dk
Wed Jul 2 11:44:53 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 ae65b0a386fc7a08e4173cc302804f0169b4d597
Author: Alexis Sukrieh <alexis at weborama.com>
Date:   Fri Mar 4 11:59:05 2011 +0100

    FIX content_types
---
 lib/Dancer/Plugin/REST.pm | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/lib/Dancer/Plugin/REST.pm b/lib/Dancer/Plugin/REST.pm
index 8239a51..8d6679b 100644
--- a/lib/Dancer/Plugin/REST.pm
+++ b/lib/Dancer/Plugin/REST.pm
@@ -9,6 +9,12 @@ use Dancer::Plugin;
 our $AUTHORITY = 'SUKRIA';
 our $VERSION   = '0.04';
 
+my $content_types = {
+    json => 'application/json',
+    yml  => 'text/x-yaml',
+    xml  => 'application/xml',
+};
+
 register prepare_serializer_for_format => sub {
     my $conf        = plugin_setting;
     my $serializers = (
@@ -36,6 +42,8 @@ register prepare_serializer_for_format => sub {
         }
 
         set serializer => $serializer;
+        my $ct = $content_types->{$format} || setting('content_type');
+        content_type $ct;
     };
 };
 

-- 
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