如何在Ruby中(带有任何库)发出POST请求并传递文本/纯文本主体?
当前,我正在使用Curl,它似乎不起作用:
url = 'http://localhost:8080/post_endpoint'
c = Curl::Easy.new(url)
c.timeout = 20
c.connect_timeout = 20
c.dns_cache_timeout = 20
c.ssl_verify_peer = false
postData = "dummy"
c.http_post(postData) do |c|
d = 1
end
(只是超时)