Merge "Fix debug curl commands for included data"
This commit is contained in:
@@ -186,11 +186,12 @@ class Session(object):
|
||||
for header in six.iteritems(headers):
|
||||
string_parts.append('-H "%s: %s"' % header)
|
||||
|
||||
_logger.debug('REQ: %s', ' '.join(string_parts))
|
||||
try:
|
||||
string_parts.append("-d '%s'" % kwargs['data'])
|
||||
except KeyError:
|
||||
pass
|
||||
|
||||
data = kwargs.get('data')
|
||||
if data:
|
||||
_logger.debug('REQ BODY: %s', data)
|
||||
_logger.debug('REQ: %s', ' '.join(string_parts))
|
||||
|
||||
# Force disable requests redirect handling. We will manage this below.
|
||||
kwargs['allow_redirects'] = False
|
||||
|
@@ -147,13 +147,15 @@ class SessionTests(utils.TestCase):
|
||||
session = client_session.Session(verify=False)
|
||||
headers = {'HEADERA': 'HEADERVALB'}
|
||||
body = 'BODYRESPONSE'
|
||||
data = 'BODYDATA'
|
||||
self.stub_url(httpretty.POST, body=body)
|
||||
session.post(self.TEST_URL, headers=headers)
|
||||
session.post(self.TEST_URL, headers=headers, data=data)
|
||||
|
||||
self.assertIn('curl', self.logger.output)
|
||||
self.assertIn('POST', self.logger.output)
|
||||
self.assertIn('--insecure', self.logger.output)
|
||||
self.assertIn(body, self.logger.output)
|
||||
self.assertIn("'%s'" % data, self.logger.output)
|
||||
|
||||
for k, v in six.iteritems(headers):
|
||||
self.assertIn(k, self.logger.output)
|
||||
|
Reference in New Issue
Block a user