diff options
author | Carol Willing <carolcode@willingconsulting.com> | 2014-08-28 16:45:24 -0700 |
---|---|---|
committer | Carol Willing <carolcode@willingconsulting.com> | 2014-08-28 16:45:24 -0700 |
commit | b34a496649667b9324caa634cb17e726e0cce1a5 (patch) | |
tree | 34ad1f635f91214a38b648c59e958b17760e139e | |
parent | 8f17741849edb5e7eba0356f90cb17e43c938a2f (diff) | |
download | python-requests-b34a496649667b9324caa634cb17e726e0cce1a5.tar.gz |
Adds review changes
-rw-r--r-- | requests/models.py | 4 | ||||
-rwxr-xr-x | test_requests.py | 3 |
2 files changed, 4 insertions, 3 deletions
diff --git a/requests/models.py b/requests/models.py index b6ef9190..1b110b49 100644 --- a/requests/models.py +++ b/requests/models.py @@ -301,7 +301,7 @@ class PreparedRequest(RequestEncodingMixin, RequestHooksMixin): self.prepare_url(url, params) self.prepare_headers(headers) self.prepare_cookies(cookies) - self.prepare_body(data, files) + self.prepare_body(data, files, json) self.prepare_auth(auth, url) # Note that prepare_auth must be last to enable authentication schemes # such as OAuth to work on a fully prepared request. @@ -442,7 +442,7 @@ class PreparedRequest(RequestEncodingMixin, RequestHooksMixin): if files: (body, content_type) = self._encode_files(files, data) else: - if data: + if data and not _json: body = self._encode_params(data) if not _json: if isinstance(data, basestring) or hasattr(data, 'read'): diff --git a/test_requests.py b/test_requests.py index 2e98cb91..af272355 100755 --- a/test_requests.py +++ b/test_requests.py @@ -992,7 +992,8 @@ class RequestsTestCase(unittest.TestCase): json={'life': 42} ) assert r.status_code == 200 - assert 'application/json' in r.headers['Content-Type'] + assert 'application/json' in r.request.headers['Content-Type'] + #assert {'life': 42} == r.json()['json'] class TestContentEncodingDetection(unittest.TestCase): |