我是来自Java的Ruby的新手.我正在尝试发出一个http get请求,我得到一个400的http响应代码.我通过http调用的服务非常特别,我很确定我的请求不完全正确.req在我执行head请求(下面)之后"查看" 对象是有帮助的,以便仔细检查正在发送的request_headers是我认为我正在发送的内容.有没有办法打印出req对象?
req = Net::HTTP.new(url.host, url.port)
req.use_ssl = true
res = req.head(pathWithScope, request_headers)
code = res.code.to_i
puts "Response code: #{code}"
我试过这个:puts "Request Debug: #{req.inspect}"但它只打印这个:#<Net::HTTP www.blah.com:443 open=false>
Aug*_*aas 63
使用set_debug_output.
http = Net::HTTP.new(url.host, url.port)
http.set_debug_output($stdout) # Logger.new("foo.log") works too
http://github.com/augustl/net-http-cheat-sheet :)中的更多内容
| 归档时间: | 
 | 
| 查看次数: | 15393 次 | 
| 最近记录: |