使用Ruby 发送Restful Request (Patch)

这里以PATCH操作为例,给出发送Restful Request的方法。

require 'rest-client'
require 'json'

url = "http://127.0.0.1/api/version/sources/source_name"

update_params = {"key" => "value"}
response = RestClient::Request.execute(:method => :patch, :url => url, :timeout => 10,  :open_timeout => 10, :payload => update_params.to_json)

参考链接
GitHub: Ruby Rest-Client Package

猜你喜欢

转载自blog.csdn.net/weixin_34149796/article/details/87513872