Add a possibility to log the body of an HTTP response
See original GitHub issueIf 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 responsebody
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:
- Created 2 years ago
- Reactions:1
- Comments:5 (3 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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.
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.
OK. As I have mentioned earlier, it can be done at different layers of HTTP libraries’ stack.