我一直在使用 RestClient 请求:
response = RestClient.post server_url, post_params, accept: :json
哪个工作正常。但是我需要增加超时,因为它在服务器执行上传时不时完成。
我研究并发现唯一的解决方案是将语法更改为:
response = RestClient::Request.execute(:method => :post, :url => server_url, post_params, :timeout => 9000000000)
但是,我似乎无法'post_params'
像在之前的调用中那样传递参数 ( ) 的哈希图。我应该如何编写请求以便'post_params'
包含在内。这是一个复杂的哈希图,所以我无法增加或摆脱它。
非常感谢您的帮助。