Sha256: 48685e5ff445bc0c207e7e168343df94693ec7ec8a423d24ce19373e3a9e9e75

Contents?: true

Size: 939 Bytes

Versions: 8

Compression:

Stored size: 939 Bytes

Contents

require 'vcr/middleware/excon'

module VCR
  class LibraryHooks
    module Excon
      # @private
      def self.configure_middleware
        middlewares = ::Excon.defaults[:middlewares]

        middlewares << VCR::Middleware::Excon::Request
        response_parser_index = middlewares.index(::Excon::Middleware::ResponseParser)
        middlewares.insert(response_parser_index + 1, VCR::Middleware::Excon::Response)
      end

      configure_middleware
    end
  end
end

VCR.configuration.after_library_hooks_loaded do
  # ensure WebMock's Excon adapter does not conflict with us here
  # (i.e. to double record requests or whatever).
  if defined?(WebMock::HttpLibAdapters::ExconAdapter)
    WebMock::HttpLibAdapters::ExconAdapter.disable!

    if defined?(::RSpec)
      ::RSpec.configure do |config|
        config.before(:suite) do
          WebMock::HttpLibAdapters::ExconAdapter.disable!
        end
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 2 rubygems

Version Path
vcr-6.3.1 lib/vcr/library_hooks/excon.rb
vcr-6.3.0 lib/vcr/library_hooks/excon.rb
vcr-6.2.0 lib/vcr/library_hooks/excon.rb
fluent-plugin-google-cloud-logging-on-prem-0.1.0 vendor/ruby/3.1.0/gems/vcr-6.1.0/lib/vcr/library_hooks/excon.rb
vcr-6.1.0 lib/vcr/library_hooks/excon.rb
vcr-6.0.0 lib/vcr/library_hooks/excon.rb
vcr-5.1.0 lib/vcr/library_hooks/excon.rb
vcr-5.0.0 lib/vcr/library_hooks/excon.rb