even this change is appreciated.
Tomohiro Hosaka [Wed, 16 Jan 2019 07:07:51 +0000 (16:07 +0900)]
lib/Catalyst/Response.pm
t/psgi_utils.t

index a9277b5..b0f04a3 100644 (file)
@@ -196,7 +196,7 @@ sub from_psgi_response {
         die "You can't set a Catalyst response from that, expect a valid PSGI response";
     }
 
-    return if $self->finalized_headers;
+    return unless $self->_context->has_encoding;
 
     # Encoding compatibilty.   If the response set a charset, well... we need
     # to assume its properly encoded and NOT encode for this response.  Otherwise
index e5ab61c..923defb 100644 (file)
@@ -73,6 +73,7 @@ my $psgi_app = sub {
         $writer->write("body");
         $writer->close;
     };
+    $c->clear_encoding;
     $c->res->from_psgi_response($psgi_app);
   }