From: John Napiorkowski Date: Tue, 21 Jan 2014 23:41:39 +0000 (-0600) Subject: warn if modifying headers afer finalizing them X-Git-Tag: 5.90060~26 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=commitdiff_plain;h=9ae060f08b6948a1d89eef14fff9d78e6a435d29 warn if modifying headers afer finalizing them --- diff --git a/lib/Catalyst/Response.pm b/lib/Catalyst/Response.pm index fa3b146..4d0e85a 100644 --- a/lib/Catalyst/Response.pm +++ b/lib/Catalyst/Response.pm @@ -82,6 +82,15 @@ has _context => ( clearer => '_clear_context', ); +before [qw(status headers content_encoding content_length content_type header)] => sub { + my $self = shift; + + $self->_context->log->warn( + "Useless setting a header value after finalize_headers called." . + " Not what you want." ) + if ( $self->finalized_headers && @_ ); +}; + sub output { shift->body(@_) } sub code { shift->status(@_) }