From 544d08d0f61c35358cf13b4a6b677e4e51dbbe7e Mon Sep 17 00:00:00 2001 From: Ian Cordasco Date: Fri, 1 Feb 2013 11:55:02 -0500 Subject: [PATCH] If Content-Length is already set, don't override Re: #1159 --- requests/models.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/requests/models.py b/requests/models.py index 9198c4c..a845b44 100644 --- a/requests/models.py +++ b/requests/models.py @@ -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()) -- 2.7.4