From: Upasana Date: Thu, 9 Jan 2014 17:08:01 +0000 (+0530) Subject: Use Plack::Middleware::RemoveRedundantBody X-Git-Tag: 5.90060~19 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=commitdiff_plain;h=79070bc658ced79555a17ee2b4a84269c4d32de0 Use Plack::Middleware::RemoveRedundantBody --- diff --git a/lib/Catalyst.pm b/lib/Catalyst.pm index b6a11c6..0eee708 100644 --- a/lib/Catalyst.pm +++ b/lib/Catalyst.pm @@ -46,6 +46,7 @@ use Plack::Middleware::Head; use Plack::Middleware::HTTPExceptions; use Plack::Middleware::FixMissingBodyInRedirect; use Plack::Middleware::MethodOverride; +use Plack::Middleware::RemoveRedundantBody; use Plack::Util; use Class::Load 'load_class'; @@ -1945,14 +1946,6 @@ sub finalize_headers { # Remove incorrectly added body and content related meta data when returning # an information response, or a response the is required to not include a body - if ( $response->status =~ /^(1\d\d|[23]04)$/ ) { - if($response->has_body) { - $c->log->debug('Removing body for informational or no content http responses'); - $response->body(''); - $response->headers->remove_header("Content-Length"); - } - } - $c->finalize_cookies; $c->response->finalize_headers(); @@ -3116,6 +3109,7 @@ sub registered_middlewares { if(my $middleware = $class->_psgi_middleware) { return ( Plack::Middleware::HTTPExceptions->new, + Plack::Middleware::RemoveRedundantBody->new, Plack::Middleware::FixMissingBodyInRedirect->new, Plack::Middleware::ContentLength->new, Plack::Middleware::MethodOverride->new,