Class: VCR::Middleware::Faraday
- Inherits:
-
Object
- Object
- VCR::Middleware::Faraday
- Includes:
- Deprecations::Middleware::Faraday
- Defined in:
- lib/vcr/middleware/faraday.rb
Overview
Note:
You can either insert this middleware into the Faraday middleware stack yourself or configure Configuration#hook_into to hook into ‘:faraday`.
Faraday middleware that VCR uses to record and replay HTTP requests made through Faraday.
Defined Under Namespace
Classes: RequestHandler
Instance Method Summary collapse
-
#call(env) ⇒ Object
Handles the HTTP request being made through Faraday.
-
#close ⇒ Object
Close any persistent connections.
-
#initialize(app) ⇒ Faraday
constructor
Constructs a new instance of the Faraday middleware.
Constructor Details
#initialize(app) ⇒ Faraday
Constructs a new instance of the Faraday middleware.
21 22 23 24 |
# File 'lib/vcr/middleware/faraday.rb', line 21 def initialize(app) super @app = app end |
Instance Method Details
#call(env) ⇒ Object
Handles the HTTP request being made through Faraday
29 30 31 32 |
# 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 ⇒ Object
Close any persistent connections.
35 36 37 |
# File 'lib/vcr/middleware/faraday.rb', line 35 def close @app.close if @app.respond_to?(:close) end |