From: Andy Grundman Date: Fri, 23 Feb 2007 23:38:46 +0000 (+0000) Subject: Add a default body to redirect responses X-Git-Tag: 5.7099_04~241 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=commitdiff_plain;h=39655cdc55288a5c295174f8f3b67bf87f35162b Add a default body to redirect responses --- diff --git a/Changes b/Changes index b9d4c15..32e9176 100644 --- a/Changes +++ b/Changes @@ -6,6 +6,7 @@ This file documents the revision history for Perl extension Catalyst. - Support restart_delay of 0 (for use in the POE engine). - Skip body processing if we don't have a Content-Length header. Results in about a 9% performance increase when handling GET/HEAD requests. + - Add a default body to redirect responses. 5.7006 2006-11-03 14.18 - Updated manifest diff --git a/lib/Catalyst.pm b/lib/Catalyst.pm index e73e2c6..c4a2089 100644 --- a/lib/Catalyst.pm +++ b/lib/Catalyst.pm @@ -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( + "

This item has moved here.

" + ); + } } # Content-Length