Class: VCR::Middleware::Faraday::RequestHandler
- Inherits:
-
RequestHandler
- Object
- RequestHandler
- VCR::Middleware::Faraday::RequestHandler
- Defined in:
- lib/vcr/middleware/faraday.rb
Instance Attribute Summary collapse
-
#app ⇒ Object
readonly
Returns the value of attribute app.
-
#env ⇒ Object
readonly
Returns the value of attribute env.
Instance Method Summary collapse
- #handle ⇒ Object
-
#initialize(app, env) ⇒ RequestHandler
constructor
A new instance of RequestHandler.
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
#app ⇒ Object (readonly)
Returns the value of attribute app.
41 42 43 |
# File 'lib/vcr/middleware/faraday.rb', line 41 def app @app end |
#env ⇒ Object (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
#handle ⇒ Object
47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/vcr/middleware/faraday.rb', line 47 def handle # Faraday must be exclusive here in case another library hook is being used. # We don't want double recording/double playback. VCR.library_hooks.exclusive_hook = :faraday collect_chunks if env.request.stream_response? super ensure response = defined?(@vcr_response) ? @vcr_response : nil invoke_after_request_hook(response) unless delay_finishing? end |