amro/gibbon

Deprecated warning on Faraday::Connection#basic_auth

penghouho opened this issue · 4 comments

Raising

WARNING: Faraday::Connection#basic_auth is deprecated; it will be removed in version 2.0.
While initializing your connection, use #request(:basic_auth, ...) instead.
See https://lostisland.github.io/faraday/middleware/authentication for more usage info.

because of

client.basic_auth('apikey', self.api_key)

I suggested to change to

    def rest_client
      client = Faraday.new(self.api_url, proxy: self.proxy, ssl: { version: "TLSv1_2" }) do |faraday|
        faraday.response :raise_error
        faraday.adapter adapter
        if @request_builder.debug
          faraday.response :logger, @request_builder.logger, bodies: true
        end
        # below line is new line
        faraday.request :basic_auth, 'apikey', self.api_key
      end
#      client.basic_auth('apikey', self.api_key)
      client
    end
amro commented

Thank you very much for the heads up. Do you have time to prep a pull request with this change? If not I can try to get to it this weekend

I don't have a real instance to test its functionality, may count on you to further repair it, thanks

fabn commented

Got same issue and I confirm that the suggested change fixes the warning.

amro commented

Thanks both. I've released Gibbon version 3.4.1, which should address your concerns. Let me know if you run into trouble.