add github issue tracker links to contributing documentation
[catagits/Catalyst-Runtime.git] / lib / Catalyst / Response.pm
index 74d59fe..fa15afb 100644 (file)
@@ -109,7 +109,7 @@ before [qw(status headers content_encoding content_length content_type header)]
   $self->_context->log->warn( 
     "Useless setting a header value after finalize_headers and the response callback has been called." .
     " Not what you want." )
-      if ( $self->finalized_headers && !$self->_has_response_cb && @_ );
+      if ( $self->_context && $self->finalized_headers && !$self->_has_response_cb && @_ );
 };
 
 sub output { shift->body(@_) }
@@ -134,6 +134,20 @@ sub write {
     return $len;
 }
 
+sub unencoded_write {
+    my ( $self, $buffer ) = @_;
+
+    # Finalize headers if someone manually writes output
+    $self->_context->finalize_headers unless $self->finalized_headers;
+
+    $buffer = q[] unless defined $buffer;
+
+    my $len = length($buffer);
+    $self->_writer->write($buffer);
+
+    return $len;
+}
+
 sub finalize_headers {
     my ($self) = @_;
     return;