Kota Tsuyuzaki 6f21504ccc Fix missing content length of Response
This patch fixes swob.Response to set missing content
length correctly.

When a child class of swob.Response is initialized with
both "body" and "headers" arguments which includes content
length, swob.Response might loose the acutual content length
generated from the body because "headers" will overwrite the
content length property after the body assignment.

It'll cause the difference between headers's content length
and acutual body length. This would affect mainly 3rd party
middleware(s) to make an original response as follows:

req = swob.Request.blank('/')
req.method = 'HEAD'
resp = req.get_response(app)
return HTTPOk(body='Ok', headers=resp.headers)

This patch changes the order of headers updating and then
fixes init() to set correct content length.

Change-Id: Icd8b7cbfe6bbe2c7965175969af299a5eb7a74ef
2015-01-15 21:20:16 -08:00
..
2014-11-25 15:44:30 +00:00