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
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
Adds a callback that will be executed around each HTTP request.

 @example
  VCR.configure do |c|
    c.around_http_request(lambda {|r| r.uri =~ /api.geocoder.com/}) do |request|
      # extract an address like "1700 E Pine St, Seattle, WA"
      # from a query like "address=1700+E+Pine+St%2C+Seattle%2C+WA"
      address = CGI.unescape(URI(request.uri).query.split('=').last)
      VCR.use_cassette("geocoding/#{address}", &request)
    end
  end

 @yield the callback
 @yieldparam request [VCR::Request::FiberAware] the request that is being made
 @raise [VCR::Errors::NotSupportedError] if the fiber library cannot be loaded.
 @param filters [optional splat of #to_proc] one or more filters to apply.
   The objects provided will be converted to procs using `#to_proc`. If provided,
   the callback will only be invoked if these procs all return `true`.
 @note This method can only be used on ruby interpreters that support
  fibers (i.e. 1.9+). On 1.8 you can use separate `before_http_request` and
  `after_http_request` hooks.
 @note You _must_ call `request.proceed` or pass the request as a proc on to a
  method that yields to a block (i.e. `some_method(&request)`).
 @see #before_http_request
 @see #after_http_request