From: Ian Cordasco Date: Sun, 25 Nov 2012 02:47:47 +0000 (-0500) Subject: Attach Content-Length to everything. X-Git-Tag: v1.0.0~104^2~4^2~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f003025a37f9d546570e52f7d355c6f5d1a81617;p=services%2Fpython-requests.git Attach Content-Length to everything. Closes #223 --- diff --git a/requests/models.py b/requests/models.py index 9c0666a..84fae6e 100644 --- a/requests/models.py +++ b/requests/models.py @@ -541,6 +541,10 @@ class Request(object): else: content_type = 'application/x-www-form-urlencoded' + self.headers['Content-Length'] = '0' + if body is not None: + self.headers['Content-Length'] = str(len(body)) + # Add content-type if it wasn't explicitly provided. if (content_type) and (not 'content-type' in self.headers): self.headers['Content-Type'] = content_type