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):
|
for header in six.iteritems(headers):
|
||||||
string_parts.append('-H "%s: %s"' % header)
|
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')
|
_logger.debug('REQ: %s', ' '.join(string_parts))
|
||||||
if data:
|
|
||||||
_logger.debug('REQ BODY: %s', data)
|
|
||||||
|
|
||||||
# Force disable requests redirect handling. We will manage this below.
|
# Force disable requests redirect handling. We will manage this below.
|
||||||
kwargs['allow_redirects'] = False
|
kwargs['allow_redirects'] = False
|
||||||
|
@@ -147,13 +147,15 @@ class SessionTests(utils.TestCase):
|
|||||||
session = client_session.Session(verify=False)
|
session = client_session.Session(verify=False)
|
||||||
headers = {'HEADERA': 'HEADERVALB'}
|
headers = {'HEADERA': 'HEADERVALB'}
|
||||||
body = 'BODYRESPONSE'
|
body = 'BODYRESPONSE'
|
||||||
|
data = 'BODYDATA'
|
||||||
self.stub_url(httpretty.POST, body=body)
|
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('curl', self.logger.output)
|
||||||
self.assertIn('POST', self.logger.output)
|
self.assertIn('POST', self.logger.output)
|
||||||
self.assertIn('--insecure', self.logger.output)
|
self.assertIn('--insecure', self.logger.output)
|
||||||
self.assertIn(body, self.logger.output)
|
self.assertIn(body, self.logger.output)
|
||||||
|
self.assertIn("'%s'" % data, self.logger.output)
|
||||||
|
|
||||||
for k, v in six.iteritems(headers):
|
for k, v in six.iteritems(headers):
|
||||||
self.assertIn(k, self.logger.output)
|
self.assertIn(k, self.logger.output)
|
||||||
|
Reference in New Issue
Block a user