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)