Add a default body to redirect responses
[catagits/Catalyst-Runtime.git] / lib / Catalyst.pm
index 02af3c1..c4a2089 100644 (file)
@@ -61,7 +61,7 @@ __PACKAGE__->response_class('Catalyst::Response');
 
 # Remember to update this in Catalyst::Runtime as well!
 
-our $VERSION = '5.7006';
+our $VERSION = '5.7007';
 
 sub import {
     my ( $class, @arguments ) = @_;
@@ -1391,6 +1391,13 @@ sub finalize_headers {
     if ( my $location = $c->response->redirect ) {
         $c->log->debug(qq/Redirecting to "$location"/) if $c->debug;
         $c->response->header( Location => $location );
+        
+        if ( !$c->response->body ) {
+            # Add a default body if none is already present
+            $c->response->body(
+                "<p>This item has moved <a href=\"$location\">here</a>.</p>"
+            );
+        }
     }
 
     # Content-Length