如何使用授权标题正确设置此RestClient帖子的格式

时间:2018-12-07 16:47:58

标签: ruby-on-rails ruby

RestClient.post "https://example.com`", {"id"=>"","name"=>params[:company_name],"frate"=>"0.005"}.to_json,{:Authorization => bearertoken},{content_type: :json, accept: :json}

我收到以下错误:

ArgumentError (wrong number of arguments (given 4, expected 2..3)):

1 个答案:

答案 0 :(得分:1)

您已经正确传递了Authorization标头,但是将其他两个标头分开时应该分开。尝试这样:

RestClient.post "https://example.com`", {"id"=>"","name"=>params[:company_name],"frate"=>"0.005"}.to_json,{:Authorization => bearertoken ,content_type: :json, accept: :json}
相关问题