Skip to content

Instantly share code, notes, and snippets.

@julik
Created May 9, 2014 15:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save julik/319e391513df750cb9fe to your computer and use it in GitHub Desktop.
Save julik/319e391513df750cb9fe to your computer and use it in GitHub Desktop.
# This line makes me sad
Faraday::Adapter.register_middleware File.expand_path(File.dirname(__FILE__)),
:certificate_pinning => [:CertificatePinning, 'certificate_pinning/certificate_pinning']
Faraday.new(:url => 'https://fancy-startup.io/api') do |f|
f.use :http_cache, store: @cache
f.request :url_encoded
f.response :logger
f.adapter :certificate_pinning # I want to use my custom Adapter subclass here
end
@mislav
Copy link

mislav commented May 9, 2014

How about this?

f.adapter My::Namespace::CertificatePinning

@julik
Copy link
Author

julik commented May 9, 2014

Tried it first, but I don't have namespaces.

require_relative 'certificate_pinning/certificate_pinning'

Faraday.new(:url => 'https://shotsky.io') do |f|
  f.use :http_cache, store: @cache
  f.request  :url_encoded
  f.response :logger
  f.adapter  CertificatePinning
end

"CertificatePinning is not registered on Faraday::Adapter"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment