separate request/response possible content-typees
[catagits/Catalyst-Action-REST.git] / lib / Catalyst / Action / SerializeBase.pm
index b51e1ab..3bb3427 100644 (file)
@@ -8,7 +8,7 @@ use Module::Pluggable::Object;
 use Catalyst::Request::REST;
 use Catalyst::Utils ();
 
-our $VERSION = '0.85';
+our $VERSION = '0.90';
 $VERSION = eval $VERSION;
 
 after BUILDARGS => sub {
@@ -69,7 +69,12 @@ sub _load_content_plugins {
         push @accepted_types, @$stashed;
     }
     # then content types requested by caller
-    push @accepted_types, @{ $c->request->accepted_content_types };
+    push @accepted_types, 
+        $search_path =~ m{Deserialize} 
+            ?  @{ $c->request->accepted_content_types }
+            :  @{ $c->request->accepted_response_content_types }
+            ; 
+
     # then the default
     push @accepted_types, $config->{'default'} if $config->{'default'};
     # pick the best match that we have a serializer mapping for
@@ -157,6 +162,8 @@ sub _serialize_bad_request {
 
 __PACKAGE__->meta->make_immutable;
 
+1;
+
 =head1 NAME
 
 Catalyst::Action::SerializeBase - Base class for Catalyst::Action::Serialize and Catlayst::Action::Deserialize.