set 'None' to body for request if given body is 'None' ( issue #3020 ) (#3021)

This commit is contained in:
Takuro Wada
2016-06-02 15:51:13 +09:00
committed by wing328
parent 23d2c56096
commit 91c35509b8
10 changed files with 180 additions and 16 deletions

View File

@@ -122,8 +122,11 @@ class RESTClientObject(object):
if query_params:
url += '?' + urlencode(query_params)
if headers['Content-Type'] == 'application/json':
request_body = None
if body:
request_body = json.dumps(body)
r = self.pool_manager.request(method, url,
body=json.dumps(body),
body=request_body,
headers=headers)
if headers['Content-Type'] == 'application/x-www-form-urlencoded':
r = self.pool_manager.request(method, url,