if we change encoding on $c after asking for a write_fh we want to make sure catalyst...
John Napiorkowski [Wed, 7 Jan 2015 18:40:42 +0000 (12:40 -0600)]
lib/Catalyst/Response.pm
lib/Catalyst/Response/Writer.pm

index 186eb0d..13a1f63 100644 (file)
@@ -67,7 +67,7 @@ sub _build_write_fh {
   my $requires_encoding = $_[0]->encodable_response;
   my %fields = (
     _writer => $writer,
-    _encoding => $_[0]->_context->encoding,
+    _context => $_[0]->_context,
     _requires_encoding => $requires_encoding,
   );
 
index 55cbdd1..5044bbd 100644 (file)
@@ -5,7 +5,7 @@ sub close { shift->{_writer}->close }
 
 sub write_encoded {
   my ($self, $line) = @_;
-  if((my $enc = $self->{_encoding}) && $self->{_requires_encoding}) {
+  if((my $enc = $self->{_context}->encoding) && $self->{_requires_encoding}) {
     # Not going to worry about CHECK arg since Unicode always croaks I think - jnap
     $line = $enc->encode($line);
   }