Sha256: bb1344fa41e331aa01d3678c7cd08170f31fb2e61f77bbe2ac2786004e27924a
Contents?: true
Size: 1.44 KB
Versions: 18
Compression:
Stored size: 1.44 KB
Contents
require 'vcr/middleware/faraday' module VCR class LibraryHooks # @private module Faraday # @private module BuilderClassExtension def new(*args) super.extend BuilderInstanceExtension end ::Faraday::Builder.extend self end # @private module BuilderInstanceExtension def lock!(*args) insert_vcr_middleware super end private def insert_vcr_middleware return if handlers.any? { |h| h.klass == VCR::Middleware::Faraday } adapter_index = handlers.index { |h| h.klass < ::Faraday::Adapter } adapter_index ||= handlers.size warn_about_after_adapter_middleware(adapter_index) insert_before(adapter_index, VCR::Middleware::Faraday) end def warn_about_after_adapter_middleware(adapter_index) after_adapter_middleware_count = (handlers.size - adapter_index - 1) return if after_adapter_middleware_count < 1 after_adapter_middlewares = handlers.last(after_adapter_middleware_count) warn "WARNING: The Faraday connection stack contains middleware after " + "the HTTP adapter (#{after_adapter_middlewares.map(&:inspect).join(', ')}). " + "This is a non-standard configuration and VCR may not be able to " + "record the HTTP requests made through this Faraday connection." end end end end end
Version data entries
18 entries across 18 versions & 3 rubygems