Print request headers and not response headers

This commit is contained in:
Guillaume Ayoub 2011-04-25 19:36:19 +02:00
parent 0a0764e789
commit 5f14a92633

View File

@ -94,15 +94,16 @@ def _log_request_content(request, function):
content_length = int(request.headers.get("Content-Length", 0)) content_length = int(request.headers.get("Content-Length", 0))
if content_length: if content_length:
request._content = request.rfile.read(content_length) request._content = request.rfile.read(content_length)
log.LOGGER.debug(
"Request headers:\n%s" % "\n".join(
": ".join((key, value))
for key, value in request.headers.items()))
log.LOGGER.debug("Request content:\n%s" % request._content) log.LOGGER.debug("Request content:\n%s" % request._content)
else: else:
request._content = None request._content = None
function(request) function(request)
log.LOGGER.debug(
"Response headers:\n%s" % "\n".join(
": ".join((key, value)) for key, value in request.headers.items()))
if getattr(request, "_answer"): if getattr(request, "_answer"):
log.LOGGER.debug( log.LOGGER.debug(
"Response content:\n%s" % request._answer) "Response content:\n%s" % request._answer)