Questo è il mio codice.Come implementare i cookie in Ruby Net :: HTTP
Ora ho bisogno di inviare un cookie all'host ma non riesco a trovare una soluzione.
def get_network_file(url=nil)
begin
http = Net::HTTP.new(@service_server, 80)
resp, data = http.get(url, { "Accept-Language" => @locale })
if resp.code.to_i != 200
RAILS_DEFAULT_LOGGER.error "*** return code != 200. code = #{resp.code}"
return ""
end
rescue Exception => exc
RAILS_DEFAULT_LOGGER.error "*** message --> #{exc.message}"
return ""
end
return data
end
end
possibile duplicato del [biscotto Come implementare supporto in ruby net/http?] (http://stackoverflow.com/questions/1486703/how-to-implement-cookie-support-in-ruby-net-http) –