Fix curl debug output for requests with a body

Rather than output the request body as a separate line, make it part of
the example curl command using the -d option.

Partial-Bug: #1249891
Change-Id: Ie3fe4535f554333c67244a13c5698c025f000e7e
This commit is contained in:
Kieran Spear
2013-11-11 13:06:52 +11:00
parent 6454bc2894
commit 6a865eab33

View File

@@ -101,11 +101,11 @@ def request(url, method='GET', headers=None, original_ip=None, debug=False,
for header in six.iteritems(headers):
string_parts.append(' -H "%s: %s"' % header)
logger.debug("REQ: %s" % "".join(string_parts))
data = kwargs.get('data')
if data:
logger.debug("REQ BODY: %s\n" % data)
string_parts.append(" -d '%s'" % data)
logger.debug("REQ: %s\n", "".join(string_parts))
try:
resp = requests.request(