gabrielfalcao/HTTPretty — pull request #160 by kouk (2014-04-07 07:19:45+00:00)
Title: don't overwrite content-length header with callable body

As per https://github.com/spulec/moto/issues/116, there is sometimes a need to set the content-length header of the response from the response callback. In `moto` this is because AWS S3 response to HEAD requests should contain a `content-length` header equal to the underlying object's size. The suggested way of setting `content-length` according to HTTPretty docs is to give the forcing_headers argument to HTTPretty.register_uri, but this is not practical if the value needs to vary with each request. This change permits the response callback to set the content-length header itself without it being overwritten by `HTTPretty`.