don't overwrite content-length header with callable body

This commit is contained in:
Konstantinos Koukopoulos 2014-04-07 09:29:03 +03:00 committed by Gabriel Falcão
parent 70af1f8cf9
commit d9099192ea
No known key found for this signature in database
GPG Key ID: 0AE7DE5129AE40E4
1 changed files with 7 additions and 8 deletions

View File

@ -673,14 +673,13 @@ class Entry(BaseClass):
headers = self.normalize_headers(headers)
status = headers.get('status', self.status)
if self.body_is_callable:
status, headers, self.body = self.callable_body(
self.request,
self.info.full_url(),
headers
)
headers.update({
'content-length': text_type(len(self.body))
})
status, headers, self.body = self.callable_body(self.request, self.info.full_url(), headers)
headers = self.normalize_headers(headers)
# TODO: document this behavior:
if 'content-length' not in headers:
headers.update({
'content-length': len(self.body)
})
string_list = [
'HTTP/1.1 %d %s' % (status, STATUSES[status]),