1

I'm trying to send http post request from my application using faraday gem, but I keep receiving this error wrong number of arguments (given 2, expected 0..1) in that line response = connection.post '/submissions' do |request|

and here is my code

def post_submission
  connection = Faraday.new(url: URL, headers: { 'Content-Type' => 'application/json' })
  response = connection.post '/submissions' do |request|
    request.params = { base64_encoded: false, wait: true }
    request.body = JSON.generate(
      source_code: @params[:source_code],
      stdin: @params[:input],
      expected_output: @problem.output,
      anguage_id: @programming_languge.judge_code
    )
  end
end

No matter what updates I do to the code, I keep receiving the same error, even when I don't add any arguments! I tried every way in the documentation to create the connection and the request but all give me the same error, anyone could help, please?

Thanks in advance

UPDATE: Screen from the error enter image description here

0 Answers0