From f003025a37f9d546570e52f7d355c6f5d1a81617 Mon Sep 17 00:00:00 2001 From: Ian Cordasco Date: Sat, 24 Nov 2012 21:47:47 -0500 Subject: [PATCH] Attach Content-Length to everything. Closes #223 --- requests/models.py | 4 ++++ 1 file changed, 4 insertions(+) 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 -- 2.34.1