projects
/
services
/
python-requests.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
991f47a
)
Attach Content-Length to everything.
author
Ian Cordasco
<graffatcolmingov@gmail.com>
Sun, 25 Nov 2012 02:47:47 +0000
(21:47 -0500)
committer
Ian Cordasco
<graffatcolmingov@gmail.com>
Sun, 25 Nov 2012 02:47:47 +0000
(21:47 -0500)
Closes #223
requests/models.py
patch
|
blob
|
history
diff --git
a/requests/models.py
b/requests/models.py
index 9c0666a6094e3c4f2d6b17d4fab75dd29c64b9ff..84fae6e36843241a283e08e5c163ad16005e605e 100644
(file)
--- 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