请你在调用http delete时纠正我在这里犯的错误。 我得到了InternalServerError而没有进一步的解释。
同一个调用在FireFox RESTClient插件上运行正常。
示例RestClient
require "rest_client"
data= {"name" => "foo"}
res = RestClient.delete(url, data.to_json)
抛出:/lib/restclient/request.rb:72:process_url_params': undefined method
delete_if'代表#(NoMethodError)
样本网/ http
http = Net::HTTP.new('some ip valid', port)
headers = {'Content-Type' => 'application/json'}
data = {"name" => "foo"}
resp, data = http.delete(path, headers)
抛出:Net :: HTTP InternalserverError
答案 0 :(得分:0)
我遇到了这个问题并通过删除json数据部分来实现它。
def doRestDelete(url, values)
puts "URL: ", url
jsonValues = values.to_json
puts jsonValues
begin
raw = RestClient.delete url # removed this bit ---> , jsonValues
puts raw
rescue => e
abort(e.response)
end
return JSON.parse(raw)
end