【发布时间】:2017-07-21 03:54:11
【问题描述】:
我正在尝试发送补丁请求以使用 ruby 使用 vimeo api 编辑视频。请求成功,但 vimeo 无法读取我的有效负载(标题和描述),即标题和描述没有改变。我使用过 HTTParty、RestClient 以及 Net::HTTP,但它们都不起作用。以下是我为发送补丁请求而实现的代码,
RestClient
payload = {"description" => "Test Description", "name" => "Test Video"}
res = RestClient.patch(
vimeo_edit_url,
payload.to_s,
{ "Authorization" => auth })
NET::HTTP
options = {'description' => "Test Description", 'name' => "Test Video"}
edit_req = Net::HTTP::Patch.new(vimeo_edit_url, initheader = { "Authorization" => auth})
edit_req.data = options.to_s
edit_uri = URI(vimeo_edit_url)
edit_http = Net::HTTP.new(edit_uri.host, edit_uri.port)
edit_http.use_ssl = true
edit_http.verify_mode = OpenSSL::SSL::VERIFY_PEER
edit_response = edit_http.request(edit_req)
通常响应将是 200 OK 更新视频详细信息,但我得到 200 OK 视频详细信息(标题和描述未更改)。就好像 vimeo 无法读取我的有效载荷一样。
【问题讨论】: