更新时间:2023-01-17 08:04:42
正确的方法是在URL后面简单地添加内容:
The correct way of doing this is to simply add the content after the URL:
c = Curl::Easy.http_post("https://example.com", json_string_goes_here
) do |curl|
curl.headers['Accept'] = 'application/json'
curl.headers['Content-Type'] = 'application/json'
curl.headers['Api-Version'] = '2.2'
end
这会将json_string设置为请求正文.
This will set the json_string to be the request body.