Urllib3 will fill in the content-length automatically

This commit is contained in:
Honza Král
2014-10-01 16:42:04 +02:00
parent 45a4d36ae1
commit 20aa35d791
2 changed files with 1 additions and 12 deletions
+1 -4
View File
@@ -40,10 +40,7 @@ class Urllib3HttpConnection(Connection):
kw = {}
if timeout:
kw['timeout'] = timeout
headers = self.headers.copy()
if body:
headers['content-length'] = str(len(body))
response = self.pool.urlopen(method, url, body, retries=False, headers=headers, **kw)
response = self.pool.urlopen(method, url, body, retries=False, headers=self.headers, **kw)
duration = time.time() - start
raw_data = response.data.decode('utf-8')
except Exception as e: