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

This commit is contained in:
Jenkins 2016-09-07 11:54:37 +00:00 committed by Gerrit Code Review
commit dde6bc4d4f
1 changed files with 3 additions and 6 deletions

View File

@ -145,13 +145,10 @@ class HTTPClient(object):
resp.text)
def serialize(self, kwargs):
if kwargs.get('json') is not None:
json_data = kwargs.pop('json', None)
if json_data 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(json_data)
def get_timings(self):
return self.times