I would like to capture the full request (raw_request -- what went over the wire) for a given action without using a proxy.
I am aware of the debug_output method on the Class, and that might be part of the solution. But unclear on how to set it on a per request basis.
Consider the following ...
@response = HTTParty.post(@job.callback_url, body: @job.to_json)
notification = Notification.new
notification.response_body = @response.body
notification.response_code = @response.code
notification.request_body = ????
Thanks!
Jonathan
@response.request
will contain the request object.
HTTParty.post(url, :body => body, :debug_output => $stdout)
Add the following under your include HTTParty
line:
debug_output $stdout
This sets an output stream for debugging and the output stream is passed on to Net::HTTP#set_debug_output.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With