You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Logging request payload\data\body with httplog is broken in 3.0.0 #437
The change introduced in #412 is responsible for this behaviour. Previously HTTP::Request#body returned the object that was assigned as :body, but now it returns an instance of HTTP::Request::Body. I'll try to come up with a PR for httplog.
The solution is not ideal, because you can't simply do source.to_s: some source types (like form data) require being rewinded after that, otherwise the request hangs forever.
See trusche/httplog#56.
For me this would be how I would like httplog to log my requests; if I'm passing for request body anything other than a string, then the request body will probably be large and I would like to avoid logging it, because it could cause my logs to grow in size. What do you think about that?
@tycooon Yeah, URL-encoded request bodies really should be shown as strings, and not as Ruby objects.
It seems that you've already solved everything in trusche/httplog#56. Yes, the HTTP::FormData bodies need to be rewinded after calling #to_s, I don't remember why I didn't make it happen automatically. Heck, I just went ahead and opened a PR for that – httprb/form_data#21 😃
Activity
janko commentedon Oct 23, 2017
The change introduced in #412 is responsible for this behaviour. Previously
HTTP::Request#bodyreturned the object that was assigned as:body, but now it returns an instance ofHTTP::Request::Body. I'll try to come up with a PR for httplog.janko commentedon Nov 11, 2017
@igorigorigorigor This PR should bring necessary changes to HTTP.rb for me to then be able to send a PR to httplog – #438.
tycooon commentedon Feb 14, 2018
The solution is not ideal, because you can't simply do
source.to_s: some source types (like form data) require being rewinded after that, otherwise the request hangs forever.See trusche/httplog#56.
janko commentedon Feb 14, 2018
@tycooon I was actually thinking of that the httplog gem would just do
source.inspect, so the logs would look like this:For me this would be how I would like httplog to log my requests; if I'm passing for request body anything other than a string, then the request body will probably be large and I would like to avoid logging it, because it could cause my logs to grow in size. What do you think about that?
tycooon commentedon Feb 15, 2018
@janko-m this doesn't work well with FormData:
janko commentedon Feb 15, 2018
@tycooon Yeah, URL-encoded request bodies really should be shown as strings, and not as Ruby objects.
It seems that you've already solved everything in trusche/httplog#56. Yes, the
HTTP::FormDatabodies need to be rewinded after calling#to_s, I don't remember why I didn't make it happen automatically. Heck, I just went ahead and opened a PR for that – httprb/form_data#21 😃janko commentedon Nov 18, 2018
@tycooon Is httplog now working properly? Can this issue be closed?
tycooon commentedon Nov 18, 2018
Yep, we fixed it here trusche/httplog#56.
janko commentedon Nov 18, 2018
Awesome, thank you!