Fix CPAN RT#76179
authorAndrew Rodland <andrew@cleverdomain.org>
Mon, 25 Jun 2012 07:07:51 +0000 (03:07 -0400)
committerAndrew Rodland <andrew@cleverdomain.org>
Mon, 25 Jun 2012 19:46:12 +0000 (15:46 -0400)
commit258733f15e1e1ec4b4d92eda4b4471833890aced
tree60d3e2c17eed97541f9bd92a78ca97c1ab2912c5
parentaa3897dbd07156dbd1b80c5d1571101140e13a11
Fix CPAN RT#76179

* Revert commit 684ca75d81f91dc5302f1654d7029c93be4f5a37. We
  actually need the context in the Response so that $c->res->write can
  call $c->finalize_headers.

* Clear _context in $c->res for debug dump output again. Now that the response
  has a _context again, we need to avoid dumping it again.

* Make Response::write call finalize_headers on the context, not $self
  Calling write causes finalize_headers to be called, so that the headers are
  available to be sent before we start sending body. This needs to be the case
  whether the user called $c->write or $c->res->write. And plugins like
  Session hook Catalyst::prepare_headers to prepare their own headers (like
  session cookies) so we really need to call the context's finalize_headers,
  and not just the response method that does the real work.

* Add tests for finalize_headers issue (failing on master, passing here)
Changes
lib/Catalyst.pm
lib/Catalyst/Engine.pm
lib/Catalyst/Response.pm
t/aggregate/live_component_controller_action_streaming.t
t/lib/TestApp.pm