Class: VCR::RequestHandler

Inherits:
Object
  • Object
show all
Includes:
Logger::Mixin
Defined in:
lib/vcr/request_handler.rb

Instance Method Summary collapse

Methods included from Logger::Mixin

#log, #response_summary

Instance Method Details

#handleObject



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/vcr/request_handler.rb', line 6

def handle
  log "Handling request: #{request_summary} (disabled: #{disabled?})"
  invoke_before_request_hook

  req_type = request_type(:consume_stub)

  log "Identified request type (#{req_type}) for #{request_summary}"

  # The before_request hook can change the type of request
  # (i.e. by inserting a cassette), so we need to query the
  # request type again.
  #
  # Likewise, the main handler logic can modify what
  # #request_type would return (i.e. when a response stub is
  # used), so we need to store the request type for the
  # after_request hook.
  set_typed_request_for_after_hook(req_type)

  send "on_#{req_type}_request"
end