PerlDancer/Dancer2 — pull request #555 by veryrusty (2014-04-02 19:32:02+00:00)
Title: Delay applying default content-type to response until its required

Previously the dispatcher was applying the default content-type to the response as soon as a route was executed, even if the route passed and returned no content. #550 is an example of when this occurs.

This patch applies the default content-type either
* immediately before the response content is encoded; or
* as the psgi response is being generated

as well as reverting the previous commit from #550 (and resolves #550) .