question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add a possibility to log the body of an HTTP response

See original GitHub issue

If I understand correctly, this library currently does not provide a way to log HTTP response body. It seems like it has been the case for years now:

Update, httplib.HTTPConnection.debuglevel = 1 seems to work quite fine but I have to remark that currently the response body is not logged and this could be extremely useful, especially for REST requests.

_Originally posted by @ssbarnea in https://github.com/urllib3/urllib3/issues/107#issuecomment-16168466_

Is it still true? If yes, would it be possible to add a way to log the body of all processed HTTP responses?

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
sigmavirus24commented, Oct 11, 2021

Is it still true? If yes, would it be possible to add a way to log the body of all processed HTTP responses?

I would be strongly opposed. The body of a response can contain very sensitive information (e.g., JWT secrets) and allowing users to log that without klaxons going off would be wildly irresponsible.

0reactions
pbasistacommented, Oct 14, 2021

unknowingly turn on logging

people don’t want to turn on urllib3 and suddenly be logging secrets

I have never suggested to use this kind of logging by default or make it easy to enable by accident. My goal was to find a simple opt-in approach.

leave this library out of it

OK. As I have mentioned earlier, it can be done at different layers of HTTP libraries’ stack.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to log request & response body to Application Insights
In this article, I am showing how to log the body of an HTTP POST or PUT request and also the response to...
Read more >
How to log raw HTTP request/response in Python FastAPI
To log the data, you could use a BackgroundTask , as described in this answer and this answer. A BackgroundTask will run only...
Read more >
HTTP Request-Response with Logger Example
This example was designed to demonstrate interaction between an end user and Mule via an HTTP request, and Mule's ability to log activity...
Read more >
Logging the Body of HTTP Request and Response in ASP ...
Being able to log the raw data of an HTTP request and response in a web application is often quite useful – especially...
Read more >
ASP.NET Core 6 - HttpLogging - log requests/responses
Log http requests/responses using ASP.NET Core HttpLoggingMiddleware.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found