github地址
https://github.com/rest-client/rest-client
gemfile里添加
gem 'rest-client', '~> 2.0'
执行bundle install
代码里
# 要请求接口地址
# 上传文件的key名字
# file 文件的绝对路径
resp = RestClient.post url, :file => File.new(file, 'rb')
json = JSON.parse(resp)
github地址
https://github.com/rest-client/rest-client
gemfile里添加
gem 'rest-client', '~> 2.0'
执行bundle install
代码里
# 要请求接口地址
# 上传文件的key名字
# file 文件的绝对路径
resp = RestClient.post url, :file => File.new(file, 'rb')
json = JSON.parse(resp)
下一篇:ruby 常用代码片段
Ruby中使用patch HTTP方法
举报文章
请选择举报类型
补充说明
0/200
上传截图
格式支持JPEG/PNG/JPG,图片不超过1.9M