diff --git a/requests/models.py b/requests/models.py index 6e20ac4d3c..ae6eb70804 100644 --- a/requests/models.py +++ b/requests/models.py @@ -473,12 +473,12 @@ def prepare_body(self, data, files, json=None): not isinstance(data, (basestring, list, tuple, Mapping)) ]) - try: - length = super_len(data) - except (TypeError, AttributeError, UnsupportedOperation): - length = None - if is_stream: + try: + length = super_len(data) + except (TypeError, AttributeError, UnsupportedOperation): + length = None + body = data if getattr(body, 'tell', None) is not None: