Add a default body to redirect responses
[catagits/Catalyst-Runtime.git] / lib / Catalyst.pm
index e73e2c6..c4a2089 100644 (file)
@@ -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