How to customize stub request using Faraday?

203 Views Asked by At

I'm trying to customize stubs via Faraday and have a little problem with setting request_body and request_headers. All test works and are green, but I'm still getting message by Rubymine: „Found extra argument“ and that part of the code is underlined in red. I would like to get rid of it. Just how to customize body and headers in right way, please?

Actual problem

1

I have tried to customize it like this:

conn = Faraday.new(url: "url") do |faraday|
        faraday.response :raise_error
      end

conn.get("url") do |req|
  req.body: {body: "body"}
  req.headers: {headers: "headers"}
end

But it did not work.

1

There are 1 best solutions below

0
Rabodaber On

Thank you for the feedback. This is a known problem, please follow the RUBY-30140/False-positive-found-extra-argument-warning-with-Faraday.get(see help if you are not familiar with YouTrack).

I've requested this issue to include in one of our nearest maintenance sprint. Sorry for inconveniences:(

Best regards Anna Kutarba.

JetBrains https://jetbrains.com The Drive to Develop