简体   繁体   中英

How to customize stub request using Faraday?

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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM