Class: VCR::Middleware::Faraday::RequestHandler

Inherits:
RequestHandler show all
Defined in:
lib/vcr/middleware/faraday.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Logger::Mixin

#log, #request_summary, #response_summary

Constructor Details

#initialize(app, env) ⇒ RequestHandler

Returns a new instance of RequestHandler.


42
43
44
45
# File 'lib/vcr/middleware/faraday.rb', line 42

def initialize(app, env)
  @app, @env = app, env
  @has_on_complete_hook = false
end

Instance Attribute Details

#appObject (readonly)

Returns the value of attribute app


41
42
43
# File 'lib/vcr/middleware/faraday.rb', line 41

def app
  @app
end

#envObject (readonly)

Returns the value of attribute env


41
42
43
# File 'lib/vcr/middleware/faraday.rb', line 41

def env
  @env
end

Instance Method Details

#handleObject


47
48
49
50
51
52
53
54
55
# File 'lib/vcr/middleware/faraday.rb', line 47

def handle
  # Faraday must be exlusive here in case another library hook is being used.
  # We don't want double recording/double playback.
  VCR.library_hooks.exclusive_hook = :faraday
  super
ensure
  response = defined?(@vcr_response) ? @vcr_response : nil
  invoke_after_request_hook(response) unless delay_finishing?
end