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.
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'):
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):