mirror of
https://github.com/kennethreitz/requests.git
synced 2026-06-05 22:50:18 +00:00
Set 'Transfer-Encoding: chunked' if data file length equals 0
This commit is contained in:
@@ -446,6 +446,8 @@ class PreparedRequest(RequestEncodingMixin, RequestHooksMixin):
|
||||
if data:
|
||||
body = self._encode_params(data)
|
||||
if isinstance(data, basestring) or hasattr(data, 'read'):
|
||||
if hasattr(data, 'fileno') and length == 0:
|
||||
self.headers['Transfer-Encoding'] = 'chunked'
|
||||
content_type = None
|
||||
else:
|
||||
content_type = 'application/x-www-form-urlencoded'
|
||||
|
||||
Reference in New Issue
Block a user