How to debug/display request sent using RestClient

前端 未结 5 1336
执念已碎
执念已碎 2021-02-03 18:37

I am trying to use RestClient to access a webservice using post method. I am sending the authorization token as specified but I am still getting a 403 status error which means I

5条回答
  •  难免孤独
    2021-02-03 19:17

    In case you don't know (or want to bother) to pass in env. variable to your app (in my case it was Passenger/Rails), do something similar:

    $ cat >/usr/share/foreman/config/initializers/00_rest_client.rb <<'EOT'
    require 'rest_client'
    RestClient.log =
      Object.new.tap do |proxy|
        def proxy.<<(message)
          Rails.logger.info message
        end
      end
    EOT
    

提交回复
热议问题