net http - How do you make a POST request in ruby 2.3.0 with unlimited read_timeout -


i have following block of code, using ruby 2.3.0 , net:http, how include timeout server can take more 60 seconds respond? i'm having specific challenges including array in body too, when use httparty

require 'uri' require 'net/http' require 'open-uri'  url = uri.parse('http://local-tomcat.com:8080/local-api/v1/anobject/create') post_params = {"querytoken"=>"4b58f48b-5197-4c86-8783-e15096fe3a6f",           "tenantid"=>"99218d0e-1757-4fd7-a7c1-5642adcb57e3",             "projectid"=>"4885536d-06a8-41ed-8002-1619966b14e2",             "destinations"=>["2cc1053b-20fd-4191-b3f4-219a9099ad63|4885536d-06a8-41ed-8002-1619966b14e2|99218d0e-1757-4fd7-a7c1-5642adcb57e3|5ceabd11-a2b1-4c8e-89b2-c0d75a7d7f8e","515104a7-e4ae-4905-893c-835500f0f962|4885536d-06a8-41ed-8002-1619966b14e2|99218d0e-1757-4fd7-a7c1-5642adcb57e3|5ceabd11-a2b1-4c8e-89b2-c0d75a7d7f8e"],           "firstexecution"=>true} response = net::http.post_form(url, post_params) puts response.body 

never mind, figured out:

net::http.start(url.host, url.port, read_timeout: 999_999) |http|   request = net::http::post.new(url)   request.body = uri.encode_www_form(post_params)   response = http.request request end 

Comments

Popular posts from this blog

python Tkinter Capturing keyboard events save as one single string -

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

javascript - Z-index in d3.js -