lib/vcr/request_handler.rb in vcr-2.1.1 vs lib/vcr/request_handler.rb in vcr-2.2.0
- old
+ new
@@ -30,12 +30,13 @@
@after_hook_typed_request = Request::Typed.new(vcr_request, request_type)
end
def request_type(consume_stub = false)
case
+ when externally_stubbed? then :externally_stubbed
when should_ignore? then :ignored
- when has_response_stub?(consume_stub) then :stubbed
+ when has_response_stub?(consume_stub) then :stubbed_by_vcr
when VCR.real_http_connections_allowed? then :recordable
else :unhandled
end
end
@@ -48,10 +49,14 @@
def invoke_after_request_hook(vcr_response)
return if disabled?
VCR.configuration.invoke_hook(:after_http_request, @after_hook_typed_request, vcr_response)
end
+ def externally_stubbed?
+ false
+ end
+
def should_ignore?
disabled? || VCR.request_ignorer.ignore?(vcr_request)
end
def disabled?
@@ -74,13 +79,16 @@
# extracts `:typhoeus` from `VCR::LibraryHooks::Typhoeus::RequestHandler`
@library_name ||= self.class.name.split('::')[-2].downcase.to_sym
end
# Subclasses can implement these
+ def on_externally_stubbed_request
+ end
+
def on_ignored_request
end
- def on_stubbed_request
+ def on_stubbed_by_vcr_request
end
def on_recordable_request
end