class VCR::Middleware::Faraday

Faraday middleware that VCR uses to record and replay HTTP requests made through Faraday.

@note You can either insert this middleware into the Faraday middleware stack

yourself or configure {VCR::Configuration#hook_into} to hook into `:faraday`.

Public Class Methods

new(app) click to toggle source

Constructs a new instance of the Faraday middleware.

@param [#call] app the faraday app

# File lib/vcr/middleware/faraday.rb, line 21
def initialize(app)
  super
  @app = app
end

Public Instance Methods

call(env) click to toggle source

Handles the HTTP request being made through Faraday

@param [Hash] env the Faraday request env hash

# File lib/vcr/middleware/faraday.rb, line 29
def call(env)
  return @app.call(env) if VCR.library_hooks.disabled?(:faraday)
  RequestHandler.new(@app, env).handle
end
close() click to toggle source

Close any persistent connections.

# File lib/vcr/middleware/faraday.rb, line 35
def close
  @app.close if @app.respond_to?(:close)
end