New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Faraday not logging POST request body #254
Comments
The logger doesn't do bodies. Maybe this can be an optional feature, but by default I don't think it should ever do bodies because they can be pretty big and would inflate the log very quickly. |
I think there are multiple use-cases where you would want to log the entire body. I need this too. Yes, bodies can be pretty big, but we can use log level |
@mtarnovan Agreed. Follow the referenced pull request for updates. We might add the feature but it will have to be opt-in, and it will need to have some sort of guard to avoid dumping non-plaintext bodies (such as compressed or binary responses) |
👍 Key for debugging |
Since I found this page through Google: this is now supported. require "logger"
Faraday.new do |faraday|
faraday.response :logger, ::Logger.new(STDOUT), bodies: true
end There are also more fine-grained settings available if you need them. See the pull request. |
This doesn't seem to work for |
Hi @vemv, the order of middlewares is extremely important in Faraday. |
I know this is old, but did it not occur to anyone that the OP is logging the response: |
@jpickwell you use |
just came across this; by this line it appears that you need to pass two args to see the request body:
(unless that has changed in a more recent commit 🤔 ) |
@davidalpert that's not necessary, you can simply pass the |
I'm using the following code to create a connection:
Then, I'm performing a post in this way:
The request works fine. The problem is that I'm not seeing the request body in the logs, only the request url.
The text was updated successfully, but these errors were encountered: