How can I print information about a NET:HTTPRequest for debug purposes?

后端 未结 2 765
深忆病人
深忆病人 2021-02-05 01:03

I\'m new to Ruby coming from Java. I\'m trying to make a http get request and I\'m getting an http response code of 400. The service I\'m calling over http is very particular an

2条回答
  •  醉酒成梦
    2021-02-05 01:42

    Use set_debug_output.

    http = Net::HTTP.new(url.host, url.port)
    http.set_debug_output($stdout) # Logger.new("foo.log") works too
    

    That and more in http://github.com/augustl/net-http-cheat-sheet :)

提交回复
热议问题