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: if 'body' in kwargs:
kwargs['headers']['Content-Type'] = 'application/json' kwargs['headers']['Content-Type'] = 'application/json'
kwargs['data'] = json.dumps(kwargs['body']) kwargs['data'] = json.dumps(kwargs.pop('body'))
del kwargs['body']
api_versions.update_headers(kwargs["headers"], self.api_version) api_versions.update_headers(kwargs["headers"], self.api_version)
if self.timeout: if self.timeout:

View File

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