【发布时间】:2016-04-05 18:23:02
【问题描述】:
我有以下 curl 请求 -
`curl --socks5 #{proxy} --connect-timeout 10 -H "Accept: application/json" #{url}`
我想写一个法拉第请求而不是 curl 调用。我正在这样做 -
faraday = Faraday.new("#{url}", ssl:{verify: false} do |f|
f.proxy "#{proxy}"
end
faraday.get
我收到了回复,但回复中没有正文或标题。以下是回应 -
#<Faraday::Response:0x0056075d353ad0 @on_complete_callbacks=[], @env=#<Faraday::Env @method=:get @url=#<URI::HTTP:0x0056075d358328 URL:main_url> @request=#<Faraday::RequestOptions proxy=#<Faraday::ProxyOptions uri=#<URI::HTTP:0x0056075dce69d0 URL:proxy_url>>> @request_headers={"User-Agent"=>"Faraday v0.9.2"} @ssl=#<Faraday::SSLOptions (empty)> @response=#<Faraday::Response:0x0056075d353ad0 ...>>>
我在这里做错了什么?
【问题讨论】:
标签: ruby-on-rails ruby proxy faraday