Merge "Replace functions 'Dict.get' and 'del' with 'Dict.pop'"

This commit is contained in:
Jenkins
2016-08-30 02:58:10 +00:00
committed by Gerrit Code Review
2 changed files with 2 additions and 7 deletions

View File

@@ -307,8 +307,7 @@ class HTTPClient(object):
if 'body' in kwargs:
kwargs['headers']['Content-Type'] = 'application/json'
kwargs['data'] = json.dumps(kwargs['body'])
del kwargs['body']
kwargs['data'] = json.dumps(kwargs.pop('body'))
api_versions.update_headers(kwargs["headers"], self.api_version)
if self.timeout:

View File

@@ -144,11 +144,7 @@ class HTTPClient(object):
def serialize(self, kwargs):
if kwargs.get('json') is not None:
kwargs['headers']['Content-Type'] = 'application/json'
kwargs['data'] = json.dumps(kwargs['json'])
try:
del kwargs['json']
except KeyError:
pass
kwargs['data'] = json.dumps(kwargs.pop('json'))
def get_timings(self):
return self.times