class VCR::Configuration
def around_http_request(*filters, &block)
- See: #after_http_request -
See: #before_http_request -
Other tags:
- Note: - You _must_ call `request.proceed` or pass the request as a proc on to a
Note: - This method can only be used on ruby interpreters that support
Parameters:
-
filters
(optional splat of #to_proc
) -- one or more filters to apply.
Raises:
-
(VCR::Errors::NotSupportedError)
- if the fiber library cannot be loaded.
Other tags:
- Yieldparam: request - the request that is being made
Other tags:
- Yield: - the callback
def around_http_request(*filters, &block) unless VCR.fibers_available? raise Errors::NotSupportedError.new \ "VCR::Configuration#around_http_request requires fibers, " + "which are not available on your ruby intepreter." end fibers = {} fiber_errors = {} hook_allowed, hook_declaration = false, caller.first before_http_request(*filters) do |request| hook_allowed = true start_new_fiber_for(request, fibers, fiber_errors, hook_declaration, block) end after_http_request(lambda { hook_allowed }) do |request, response| fiber = fibers.delete(Thread.current) resume_fiber(fiber, fiber_errors, response, hook_declaration) end end