ruby - How can I print information about a NET:HTTPRequest for debug purposes? -
I am new to coming from Ruby Java. I am trying to get a HTTP request and I'm getting a HTPX code 400. The service I'm calling on HTL is very special and I am sure that my request is not correct when I am requesting a head (down), to check that the request is being sent, That is, what I think is sending me, then after "code" inside "code" should be helpful. Is there any way to print the Reich object?
req = net :: http.new (url.host, url.port) req.use_ssl = true res = req.head (PathwidthScope, Request_headers) code = res.code.to_i " Response code: # {code} "puts
I tried to: " Request debug: # {req.inspect} "returns
But it only prints: # & lt; Net :: HTTP www.blah.com:443 Open = false & gt;
set_debug_output
.
http = Net :: HTTP.new (url.host, url.port) Http.set_debug_output ($ stdout) # logger.new ("foo.log") works a lot < / Code>
this more in :)
Comments
Post a Comment