小编Jua*_*nin的帖子

如何在Ruby Net :: HTTP中实现cookie

那是我的代码.

现在我需要向主机发送cookie但我找不到解决方案.


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
Run Code Online (Sandbox Code Playgroud)

ruby cookies http net-library

6
推荐指数
1
解决办法
8154
查看次数

标签 统计

cookies ×1

http ×1

net-library ×1

ruby ×1