codysoyland/django-phased — pull request #15 by philipn (2014-08-25 13:54:32+00:00)
Title: Check to see if response has Content-Length before setting it.

Because of https://github.com/codysoyland/django-phased/issues/12, I had to move `PhasedRenderMiddleware` to the bottom(ish) of my `MIDDLEWARE_CLASSES`. This fixed the issue with the `MessageMiddleware`, but caused new issues with other middleware I had that altered the length of the response.

Ideally, these other middleware classes would check to see if `Content-Length` was set, and if so, re-adjust the content length header. Unfortunately, this doesn't seem to be the case, and it seems smart for us to check to see if the header's set before adding it in here, anyway.