If you use Net::HTTP instead of rest-client, you can use http.set_debug_output $stderr
to see the contents of the request and response:
require 'net/http'
require 'openssl'
uri = URI('https://myserverip/myuri')
http = Net::HTTP.new(uri.host, uri.port)
http.set_debug_output $stderr
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Get.new(uri.request_uri)
request.basic_auth 'username', 'password'
response = http.request(request)
@data = response.body
puts response.body
In addition, using Net::HTTP, I can also get it to use a proxy by using something like http = Net::HTTP::Proxy('127.0.0.1','8888').new(uri.host, uri.port)
.
You can also do the same with rest-client by using RestClient.proxy = "http://127.0.0.1:8888/"
just before your RestClient.get(url)
etc..
This way I can send the traffic via a tool like Fiddler2 on Windows and then see all the detail I need.
It's just a shame I can't find an equivalent to Fiddler for the Mac since that's where I want to write the code.
It Looks like I'll either have to rewrite my code to use HTTP::Net instead of rest-client, or switch to Windows full time ;), unless anyone has any other thoughts.