httparty: how to log request?

Eric Francis picture Eric Francis · Mar 14, 2014 · Viewed 14.4k times · Source

How do I log requests being sent with with httparty?

HTTParty.post(
          @application_url,
          :headers => {
            "Accept"        => "application/json",
            "Content-Type"  => "application/json; charset=utf-8"
          },
          :body => {
            "ApplicationProfileId" => application.applicationProfileId
          }.to_json
        )

Answer

Brian Low picture Brian Low · Jan 31, 2015

Use debug_output at the class level:

class Foo
  include HTTParty
  debug_output $stdout
end

or per request

response = HTTParty.post(url, :body => body, :debug_output => $stdout)