changed the null check for 'data' parameter to be more explicit.

removed the superfluous encode from the testcase.
This commit is contained in:
Ravi Prakash Putchala
2015-09-09 13:04:24 +05:30
parent 37037607b5
commit 7a0cd16c1a
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -414,7 +414,7 @@ class PreparedRequest(RequestEncodingMixin, RequestHooksMixin):
content_type = None
length = None
if not data and json is not None:
if data == {} and json is not None:
content_type = 'application/json'
body = complexjson.dumps(json)
+1 -1
View File
@@ -1065,7 +1065,7 @@ class RequestsTestCase(unittest.TestCase):
def test_json_param_post_should_not_override_data_param(self):
r = requests.Request(method='POST', url='http://httpbin.org/post',
data={'stuff'.encode('utf-8'): 'elixr'},
json={'music'.encode('utf-8'): 'flute'})
json={'music': 'flute'})
prep = r.prepare()
assert 'stuff=elixr' == prep.body