From: Tomas Doran Date: Tue, 4 Oct 2011 23:24:03 +0000 (+0100) Subject: Make default body reponses for 302s W3C compliant. RT#71237 X-Git-Tag: 5.90003~8 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=commitdiff_plain;h=9c33163447834f558f3b13d7a0189bb4bd6cd5ec Make default body reponses for 302s W3C compliant. RT#71237 --- diff --git a/Changes b/Changes index c76cc9b..cc25e0b 100644 --- a/Changes +++ b/Changes @@ -1,5 +1,9 @@ # This file documents the revision history for Perl extension Catalyst. + Bug fixes: + + - Make default body reponses for 302s W3C compliant. RT#71237 + Enhancements: - Set a matching Content-type for the redirect if Catalyst sets the diff --git a/lib/Catalyst.pm b/lib/Catalyst.pm index 641c84e..6e9d63c 100644 --- a/lib/Catalyst.pm +++ b/lib/Catalyst.pm @@ -1863,9 +1863,17 @@ sub finalize_headers { if ( !$response->has_body ) { # Add a default body if none is already present - $response->body( - qq{

This item has moved here.

} - ); + $response->body(<<"EOF"); + + + + Moved + + +

This item has moved here.

+ + +EOF $response->content_type('text/html; charset=utf-8'); } } diff --git a/lib/Catalyst/Response.pm b/lib/Catalyst/Response.pm index 818ae86..834b349 100644 --- a/lib/Catalyst/Response.pm +++ b/lib/Catalyst/Response.pm @@ -14,6 +14,7 @@ has status => (is => 'rw', default => 200); has finalized_headers => (is => 'rw', default => 0); has headers => ( is => 'rw', + isa => 'HTTP::Headers', handles => [qw(content_encoding content_length content_type header)], default => sub { HTTP::Headers->new() }, required => 1,