If Content-Length is already set, don't override

Re: #1159
This commit is contained in:
Ian Cordasco
2013-02-01 11:55:02 -05:00
parent ae55676a50
commit 544d08d0f6
+2
View File
@@ -387,6 +387,8 @@ class PreparedRequest(RequestEncodingMixin, RequestHooksMixin):
self.body = body
def prepare_content_length(self, body):
if self.headers.get('Content-Length'):
return
if hasattr(body, 'seek') and hasattr(body, 'tell'):
body.seek(0, 2)
self.headers['Content-Length'] = str(body.tell())