这是我在我的localhost中发布值的代码,它在server:
中运行uri = URI.parse('http://localhost:4000/')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true if uri.scheme == "https"
headers = 'email='+email
resp = http.post(uri.path,headers)
json_obj = JSON.parse(resp.body)
if(json_obj['prediction'] == 'important')
return true
else
return false
end
代码在我的本地计算机上完美运行但在服务器生产中无效,有些人建议我添加http.use_ssl = true if uri.scheme == "https"
,但这仍然给我错误EOFError: end of file reached
,如何解决此错误?任何有这个错误的解决方案的人都将不胜感激。