Back compat fix for Gitalist
Tomas Doran [Thu, 13 May 2010 08:11:09 +0000 (10:11 +0200)]
Views don't render 3XX responses as you don't care if you're in a browser,
whereas normal structured serialization methods (e.g. JSON) do probably
want to render an entity.

Changes
lib/Catalyst/Action/Serialize/View.pm

diff --git a/Changes b/Changes
index 6b23083..3147b95 100644 (file)
--- a/Changes
+++ b/Changes
@@ -1,6 +1,13 @@
+Thu 13 May 2010 10:09:19 CEST - Release 0.85
+
+  Make Catalyst::Action::Serialize::View return directly rather than serializing
+  a response for 3XX status codes. This stops back-compat breakage from the
+  previous change (in 0.84), whilst also allowing actual data serializers
+  to still handle 3XX.
+
   Fix docs in Catalyst::TraitFor::Request::REST::ForBrowsers. (RT#54983)
 
-Thu  6 May 2010 09:27:56 - Release 0.84
+Thu  6 May 2010 09:27:56 BST - Release 0.84
   Revert always using a trait rather than Catalyst::Request::REST to improve
   debug messages.
 
index fbfa7f4..1cc4bf6 100644 (file)
@@ -11,6 +11,10 @@ sub execute {
     my $self = shift;
     my ( $controller, $c, $view ) = @_;
 
+    # Views don't care / are not going to render an entity for 3XX
+    # responses.
+    return 1 if $c->response->status =~ /^(?:204|3\d\d)$/;
+
     my $stash_key = (
             $controller->{'serialize'} ?
                 $controller->{'serialize'}->{'stash_key'} :